calculating angle differences
Hello,
I am trying to find a way to rotate a child in a hierarchy
in such a way that it matches the old rotation of
the parent after parent has been rotated.
Here is an example:
parent = viz.add('parent.wrl')
child = parent.add('child.wrl')
parent_euler = parent.get(viz.EULER)
parent.rotate(yaw1, pitch1, roll1)
now do child.rotate(yaw2, pitch2, roll2) such that
the child has the same rotation as (parallel to)
the parent did before parent rotated.
That is,
(parent_euler) == (child.get(viz.EULER, viz.ABSOLUTE_WORLD))
I am guessing that it may be possible to get the angle
difference between old parent rotation and new parent
rotation and then rotating child by that difference, I
just don't know how get the angle difference.
I am using Euler angles as examples here, but matrix trasformations would be ok also.
Is there maybe a way to detach child from parent using
the hierarchy.dlm plug-in and then reattaching them so that
child keeps old rotation (relative to world) after being attached
to parent?
Thanks in advance,
Max
|