User`s guide

4 MATLAB Interface
4-30
Because of the repetitive nature of the time interval setting, set the Time property in
a loop from within a script or program.
After you set the vrworld Time property, set the virtual scene object properties as
necessary. You should set these properties to values that correspond to the given time
frame to achieve the desired animation effect.
In each time frame, issue the vrdrawnow command for scene changes. This command
renders and updates the scene.
The following code fragment contains a typical loop that iteratively sets the Time
property, changes a virtual scene object property, and calls vrdrawnow to render the
scene:
for time=StartTime:Step:StopTime
% advance the time in the virtual scene
set(myworld,'Time',time);
% here we change VRML nodes properties
myworld.Car.translation = [ time*speed 0 0 ];
% render the changed position
vrdrawnow;
end
If you set the Time property at or outside the end boundary of RecordInterval, the
Simulink 3D Animation software stops recording. You can then view the resulting
animation file.
For a complete example of how to perform this kind of animation recording, refer to the
Simulink 3D Animation vrheat_anim example.