View Full Version : Relative Rotation/Translation Problem

12-18-2007, 10:21 PM
Here is my scenario:
I have two objects objA and objB not linked to each other. They each have a random rotation and position.

Here is what I want to do: Imagine that objB is linked to objA and then objA is basically given an identity matrix as its transform so that it returns to 0,0,0 and all rotation is reset. However, because objB was linked to it, objB is in exactly the same position RELATIVE to objA as it was previously.

What I want to know is how can I calculate the NEW transform matrix of objB without having to move or link anything?

I suspect this is simple, I just haven't been able to figure it out!

Thanks in advance,

12-18-2007, 10:24 PM
Must it be in tansform matrix form? If not, you could use the Expose Transform, I think.

12-18-2007, 10:32 PM
I'm not sure I follow you there...
What other form would it be in?

12-18-2007, 10:35 PM
If you use the Expose Transform helper, you can extract the different transformational data raw. (ie: The different between ObjA's X-Rotation and ObjB's X-Rotation).

12-18-2007, 10:46 PM
I think I follow you..

Problem is, I don't want to create any new objects or anything. (such as a transform helper) i just want to calculate the new transform.

12-18-2007, 10:57 PM
Let me jump around with the concept when I get home (At the workplace now), unless someone can beat me to the punch.

12-19-2007, 12:38 AM
try this before you assign the identity matrix to objA

$objB.transform = $objB.transform * (inverse $objA.transform)

12-19-2007, 01:53 AM
Thanks a million Floopy.

Thats exactly what I was after. Turns out I was close but not close enough!

12-19-2007, 03:16 AM
-=has been beaten to the punch=-
glad you found a solution, mate.

CGTalk Moderation
12-19-2007, 03:16 AM
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.