Jump to content
  • Advertisement
Sign in to follow this  

Relative coordinates - Absolute coordinates?

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Something that should be "really easy" to do is slipping my mind... How do I transform a bunch of rotations and transforms into absolute coordinates and an absolute matrix?
obj.child1.pos(10,0,0);  //child1 gets translated with parents matrix.
obj.child1.rot(1,0,90);  //child1's children would get translated by child1.matrix


What I've got so far is the following, but only the first child (root->child) is rotated correctly, root->child->child is rotated globaly (or something...).
            rot = parentRot * localRot;
            Vector3<scalar> direction = rot * localPos; 
            globalPos = position + direction;
            globalRot = rot;

            for (list<sceneNode>::iterator child=children.begin(); child != children.end(); ++child)

For the moment I'm using quaternions and vectors, and OpenGL for rendering, if that matters. :) Would be nice if any of you fine people could help a laddie in distress. :P /Robert

Share this post

Link to post
Share on other sites
I assume you use the typical order (given for column vectors, since you spoke of OpenGL)
T * R
where T denotes a translation and R a rotation. Then the composited transformation matrix of a local frame 1 is just
M12 := T1 * R1
what relates local co-ordinates to the superior frame 2. The superior frame 2 itself is related to its own superior frame 3
M23 := T2 * R2
Then frame 1 is related to frame 3 by
M13 := M23 * M12

You may have a look at this thread, too. It shows an efficient mechanism how to deal with the issue.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!