MATLAB: How to do multiple rotations in the Virtual Reality Toolbox 4.5 (R2007a)

Simulink 3D Animationvr

I want to change an object in my virtual world. I need to rotate it with different angles through different axes. Is this possible?

Best Answer

This is expected behavior in Virtual Reality Toolbox 4.5 (R2007a).
In VRML, the Transform node is capable of only one rotation. The rotation is specified by the rotation axis (the first three elements of the "rotation" field) and rotation angle (the fourth element).
If you want to do multiple rotations around multiple axes, you have
the following two possibilities:
  • Aggregate the two rotations (compute aggregated rotation axis and
angle) and apply the aggregated values.
  • Add another Transform node below (or above) the existing one, then do
each rotation in its own node.
Each of these approaches has its drawbacks: the first one involves
extra computation, the second one requires changing the VRML world.
Generally, users prefer the second approach: when it is clear that
two transformation will be needed, it is much easier to design the VRML
world with this in mind rather than trying to aggregate the transformations.