Change node translation and rotation
move(h,translation,rotation)
h.move(translation,rotation)
move(h,translation,rotation) and h.move(translation,rotation) set a new
position and orientation for the node object h. translation is
a 1-by-3 matrix in the aerospace body x-y-z coordinate
system or another coordinate system. In the latter case, you can use
the CoordTransformFcn function to move it into
an aerospace body. The defined aerospace body coordinate system is
defined relative to the screen as x-left, y-in, z-down.
rotation is a 1-by-3 matrix, in radians,
that specifies the rotations about the right-hand x-y-z sequence
of coordinate axes. The order of application of the rotation is z-y-x (r-q-p).
This function uses the CoordTransformFcn to apply
the translation and rotation from the input coordinate system to the
aerospace body. The function then moves the translation and rotation
from the aerospace body to the VRML x-y-z coordinates.
The defined VRML coordinate system is defined relative to the screen
as x-right, y-up, z-out.
Move the Lynx body. This example uses the Simulink®
3D Animation™ vrnode/getfield function
to retrieve the translation and rotation. These coordinates are those
used in the Simulink
3D Animation software.
h = Aero.VirtualRealityAnimation;
h.VRWorldFilename = [matlabroot,'/toolbox/aero/astdemos/asttkoff.wrl'];
copyfile(h.VRWorldFilename,[tempdir,'asttkoff.wrl'],'f');
h.VRWorldFilename = [tempdir,'asttkoff.wrl'];
h.initialize();
newtrans = getfield(h.Nodes{4}.VRNode,'translation') + 1.0;
newrot = getfield(h.Nodes{4}.VRNode,'rotation') + [.2 0.01 0.01 0.01];
h.Nodes{4}.move(newtrans,newrot);This function cannot get the node position in aerospace body
coordinates; it needs to use the CoordTransformFcn to
do so.
This function cannot set a viewpoint position or orientation
(see addViewpoint).