How to rotate child objects in 3D
Hi,
I was wondering if anyone had a good strategy for rotating child objects in 3D independently of a parent object.
For example, a car with wheels that can turn on their own axis, at the same time as following the rotation of the car itself as it goes around a turn.
I have gotten this to work to some extent by having child 3D objects inherit a parent axis if they are doing a non-self rotation (i.e. around some other center of mass).
Each 3D object has a "bind" point for its own rotation (could be the center or a hinge) – as well as a "origin" point. When I rotate any object, all child objects are instructed to rotate around an "origin" that is the same as the parent's "bind" point. In addition, child objects are handed the parent axis (since they may have already been rotated in their own frame).
So it works, but all hell breaks loose if I twist about the parent body in too many directions. I thought it was gimbal lock, and I ripped out the 3D matrix I was using and replaced with a 4D matrix and quaternions - same problem, almost exactly. I think Quaternions smoothed out some of the main-body rotation.
I'm wondering - what information do these child objects need in order to do the same relative motions in all frames?
any suggestions?