PDA

View Full Version : How to calculate transformations in an object space?


loocas
06-07-2008, 01:46 PM
Hi there, first off, the topic name is a bit misleading. All I need to know is the way to calclate an object's full transform as if it was some other object's child.

I mean, let's imagine. I have three points. $Point01 - $Point03

$Point01 is the parent of all the other points. So when I rotate/move/scale it, all the children get transformed correctly according to that. The thing I want to achieve is a script tha'd calculate the $Point03's transformation based off of $Point02's transformation change. As if the $Point03 was a direct child of the $Point02.

How do I go about it? I understand matrices as well as quats, the only problem I have is finding the right "formula" for calculating the $Point03's transform property and assigning it to it.

I know that multiplying $Point03's transform by an inverse of $Point02's transform will get me into the $Point02's space, but what then?

Any tips or hints will be greatly appretiated. :beer:

eek
06-07-2008, 06:19 PM
To get the transform 'space' of any object relative to another you do inverse matrix multiplication.

tm = $point3.transform * inverse $point2.transform

Say you have three points a,b,c. With b,c parented to a. If you want to get c's transform to behave as if it was parented to b's. You'd firstly get b's space relative to a's:

tm = (b.transform * inverse a.transform)

Then you'd transform c about this space relative to b.transform.

c.transform = tm * b.transform

Local space doesnt really exist is all just about reference and offset - essentially your setting a reference for that object to exist in. Me > Earth > Sun > Galaxy etc, etc..

CGTalk Moderation
06-07-2008, 06:19 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.