Game Development Community

Multi object relative rotation math question

by Ronald J Nelson · in Torque 3D Professional · 04/27/2013 (1:13 pm) · 1 replies

Can someone tell me how you can have two objects and if the once(lets call it the parent object), rotates or moves, the other (the child object) will move and rotate with the parent object?

In simple terms, how can I make, without mounting, an object orbit around another and always facing it as it moves and rotates?

#1
04/27/2013 (2:38 pm)
These are all math steps, not commands:

  1. Place the object unrotated at the position of the center object.
  2. Rotate the object the direction you want it to face once it at the position you want it to be. It is still at the same location as the center object.
  3. Translate the object along the vector of rotation the distance you want it to be from the center object. This treats the rotation as a definition for a vector away from the center object.

This should make it simpler to calculate. You can test this out using TS using the matrix math functions.