distance between node and frozen transforms

distance between node and frozen transforms

Anonymous
Not applicable
1,042 Views
2 Replies
Message 1 of 3

distance between node and frozen transforms

Anonymous
Not applicable

Hi there.

I'd like to calculate the distance between to objects in world space.

I'm using a distance between node that I created as a shader utility. I plug in the world matrix for the two objects and it spits out a distance. Great! However if one or both of those objects have frozen transforms then the distance value is incorrect.

I could easily use the measure tool and parent/constrain a locator under each object and get the distance that way, but that creates a whole bunch of nodes that I don't need/want and seeing as my rig is going to need a lot of these distance measurements I'd prefer a way that doesn't clutter the scene too much.

So, how do I get the world position of an object that has frozen transforms?

 

Many thanks.

0 Likes
1,043 Views
2 Replies
Replies (2)
Message 2 of 3

mspeer
Consultant
Consultant

Hi!

The world position of a frozen transform node is [0 0 0].

That's the "correct" value.

 

If you want to calculate distance based on other parameters, like bounding box, vertices or other surface information you have to do this on your own, by using helper objects and/or scripting.

0 Likes
Message 3 of 3

Kahylan
Advisor
Advisor

Hi!
I know this topic is old, but the reply isn't really helpful so I thought I would just leave the solution here in case other people (like me today) are looking for an answer here.

The easiest solution to this problem I found is to create a group or locator for each object that has frozen transforms, snap it to the object and then parent it under the object. You then can simply use the worldspace of the child object without frozen transforms. This solution adds one or two objects more to the scene, but it is still less heavy than using the measure tool

 

Alternatively, if you don't want to add more DAG objects to the scene, you could probably find a way with matrix nodes to "offset back" your world space into a 4x4 matrix and then just feed that matrix into your distance between node.
But tbh, I haven't bothered to figure that out yet, since I rarely freeze transforms, so in the few cases I do, the empy null I'm using to find the worldspace doesn't way me down much.

Hope this helps