Notifications
Clear all

[Closed] How to calculate if definite object interferes with another?

Hello,
I have a moving gizmo. And I want to try changing the objects’ state that will be crossed by my moving gizmo.
So, Is it possible to calculate such a state? I mean, when the gizmo “covers” a box for example.
Thank you in advance.

2 Replies

If its something simple like boxes or bounding boxes of an object it would be easy enough. You know if box A is intersecting with box B if the the box A’s length width or height is in the same world coorinates(xyz space) as box B’s length width or hight.

Intersection of triangles on a mesh may be more difficult. See this wikipedia entry for information on planes and the intersection of planes.

Here’s the maxscript code to check if two boxes overlap (can be modified depending on whether you need the C++ code). Arbitrary meshes are far more complex.

fn do_boxes_overlap b1_max b1_min b2_max b2_min =
(
if (b1_min.x > b2_max.x) then false
else if (b2_min.x > b1_max.x) then false
else if (b1_min.y > b2_max.y) then false
else if (b2_min.y > b1_max.y) then false
else if (b1_min.z > b2_max.z) then false
else if (b2_min.z > b1_max.z) then false
else true
)

  • Neil