User`s guide
5 Build Virtual Reality Worlds
5-44
center of rotation to coincide with the joint connecting the
hand and the tool in the hand’s local coordinates.
In a hierarchical scene structure, when the parts are connected by revolving joints, it
is easy to define the relative rotations between parts. The joint axis directly defines the
VRML rotation axis, so constructing the [axis angle] four-element VRML rotation
vector is trivial.
Initial Conditions
A Simulink model's initial conditions must correspond to the initial object’s positions and
rotations defined in the virtual world. Otherwise, the object controlled from Simulink
would “jump” from the position defined in the VRML file to the position dictated by the
Simulink software at the start of the simulation. You can compensate for this offset
either in the VRML file (by defining an another level of nested Transform around the
controlled object) or in the Simulink model by adding the object's initial position to the
model calculations before sending to the VR Sink block.
You should align the Simulink model's initial conditions with the virtual world's object
positions, while maintaining the correct position of the object relative to the surrounding
scene. To do so, you may need to adjust the position of the object's surroundings (e.g.,
move the road position so that the car at position [0 0 0] stays on the road, with the
wheels neither sinking nor floating above the road surface).
Use of VR Placeholder and VR Signal Expander
The VR Sink block accepts only inputs that define fully qualified VRML field values.
Dynamic models that describe the system behavior in only one dimension still require
full 3D positions for all controlled objects for their virtual reality visualization.
To simplify the modeling in such cases, you can use the VR Placeholder and VR
Expander blocks of the Simulink 3D Animation library.
The VR Placeholder block sends out a special value that is interpreted as “unspecified”
by the VR Sink block. When this placeholder value appears on a VR Sink input, whether
as a single value or as an element of a vector, the appropriate value in the virtual world
remains unchanged.
The VR Signal Expander block creates a vector of predefined length, using some values
from the input ports and filling the rest with placeholder signal values.
To control the position of a virtual object in a one-dimensional dynamic model, use the
VR Signal Expander block with the controlled dimension as its input. For its output use