PDA

View Full Version : Finding the position of an object in another object's coordinate system?


kotchin
02-19-2011, 11:15 AM
Hi there,

Could anyone suggest a way to find the distance between two objects, but using the first objects coordinate system. Hopefully the diagram below will help to explain what I mean a little better.

In this diagram, because the translateY attribute of the selected joint is 0, the Y position of the yellow ringed joint will be negative, relative to the selected joint, and the pink ringed joint will be positive.

http://www.tom-hunt.co.uk/otherStuff/coordsys_illus.jpg


I'm still trawling through the manual and googling to find a solution so if I find one I'll post it here.

Thanks

Tom

NaughtyNathan
02-19-2011, 12:07 PM
I think if you parent objectB to objectA it's translation will change to be the relative "distances" you want..? (and once you've grabbed the values you can then reparent it back to where it was originally). This is a quick and dirty way without any maths, which is not my strong suit... :)

:nathaN

kotchin
02-19-2011, 02:36 PM
Ah of course :banghead:
Quick and dirty is fine if it gets the job done. I've been mucking around with some rediculously long winded vector calculations.

Cheers mate

Tom

CGTalk Moderation
02-19-2011, 02:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.