Game Development Community

Rotate mounted children around arbitrary point?

by Alex Okafor · in Torque X 3D · 02/22/2007 (7:39 pm) · 2 replies

I've been looking into using the TX link/mount system to help create a foundation for some hierarchal animations, but it seems to be missing one key factor in that you can only rotate children by their center (0,0). But I'd like to rotate about the linkPoint essentially like a joint. Just wanted to know if this is already a function in TX somewhere (like a transform somewhere in t2DsceneObject that defaults to center), or if I should go ahead and start adding the functionality needed on my own.

#1
02/22/2007 (8:13 pm)
You can rotate a link point itself. In this way the object rotates about the link point rather than the object itself rotating. I haven't tried rotating things about a point other than their center but I am using objects where they are mounted at their center. I rotate the mount point and the whole object rotates. Try it and see what you get!
#2
02/22/2007 (8:33 pm)
Ah, thanks a lot! That does exactly what I want! It took me a bit to figure out how you updated the same link point. After scuffling around in the source I found AddLinkPoint() simply updates the linkpoint if the name is the same. That'd be a useful comment for that method it seems.

some test code:
float rotation;
Vector2 vec;
_player.LinkPoints.GetLinkPoint("myLink", out vec, out rotation);
_player.LinkPoints.AddLinkPoint("myLink", vec, ++rotation);