MATLAB: How to change the viewpoint in an animation during simulation in Simulink 3D Animation 5.1 (R2009b)

Simulink 3D Animation

I have multiple viewpoints defined in my virtual world and I would like to change the viewpoint in the animation during the simulation dynamically.

Best Answer

There are two ways by which you can change the viewpoint in an animation during simulation in Simulink 3D Animation 5.1 (R2009b).
The recommended way is to set the "Viewpoint" property of the "vrfigure" object as follows:
f=vrgcf;
set(f,'Viewpoint','camera0');
This can even be done from Simulink via an S-function or an Embedded MATLAB function. See example attached below.
The alternative way (not recommended) of changing the viewpoint during simulation is to set the 'set_bind' field of a Bindable 'Viewpoint' node via a Simulink signal.