# Check if intersects polygon instead of a point?

## Recommended Posts

Hello.

Is it possible? I need to check if one cube touches a side (face) of another cube (it should be exactly its side/polygon, not just a single point).

Off-topic:

What's "isInFrustrum(frustumPlanes)"?

##### Share on other sites

Hm, it looks like I figured it out myself. I used "intersectsMinMax":

`player.getBoundingInfo().boundingBox.intersectsMinMax(box.getBoundingInfo().boundingBox.vectorsWorld[0], box.getBoundingInfo().boundingBox.vectorsWorld[6])`
##### Share on other sites

`BABYLON.BoundingBox.prototype.intersectsMinMax = function (min, max) {    if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)        return false;    if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y)        return false;    if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z)        return false;    return true;};// can also be written like this:BABYLON.BoundingBox.prototype.intersectsMinMax = function (min, max) {    if (this.maximumWorld.x >= min.x && this.maximumWorld.y >= min.y && this.maximumWorld.z >= min.z && this.minimumWorld.x <= max.x && this.minimumWorld.y <= max.y && this.minimumWorld.z <= max.z)        return true;    return true;};`

intersectsMinMax allows you to check if there is an intersection (a common volume) between two bounding boxes, the one specified while calling intersectsMinMax and the one defined by min and max which are the parameters of the function. This intersection can be a single point... Vector3(max.x, max.y, max.z) = minimumWorld for example.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.