Notifications
Clear all

[Closed] distance between nodes uses pivot, i need boundingbox

hi,
I’m writing a new tool, I use the “distance node1 node2” to get my distance between two objects.
the problem is that it uses the Pivot. I need to use the bounding box.

I’m manipulating objects based on distance, the problem is that some objects are very long\high, and they do not get affected like expected.

How can I proceed and check against the points in their boundingbox?

thanks in advance.

6 Replies

Check out intersectRayEx in the maxscript help.

 lo1

you can get an array of the 8 points of their bounding box using the .min and .max properties, then check the distance of each of those points in relation to your test point, and the shortest one should be the minimal distance.

Thank you for the pointer, I will try to implement this and report back.

 lo1

Sorry, thinking about it, this is not true. There could be a point on the bounding box which is closer than a corner to another point. I think ray intersections might be your only option.

thanks for specifying, I’ll look into ray’s now.

select objects first and use .max and .min

select #(obj1,obj2)
 print selection.max