MATLAB: Can I use the VR Sink block to change the geometry of an object during a Simulink simulation

changedimensiondimensionsgeometrymfcolormffloatmfint32mfnodemfrotationmfstringmfvec2fmfvec3fmismatchmodifyobjectrealityshapesignalsimulatingSimulink 3D Animationsolidvariablevirtualvrvrmlwhile

I would like to use the VR Sink block to change the shape of a solid object during a Simulink simulation. When I select the appropriate geometry field in the VR Sink block, the VR Sink block requests signal dimensions for a single point, not all the points that make up a surface. This can be seen by turning on the "Show Signal Dimensions" property in the Simulink model.

Best Answer

It is not possible to modify the geometry of a Virtual Reality object in Simulink using the VR Sink block in Virtual Reality Toolbox 3.1 (R13.0.1+). The block does not support matrix signals for MFxxx fields. Simulink also requires signal dimensions to be constant, so the number of points in the geometry can not be varied during the simulation.
MFxxx fields are fully accessible from the MATLAB interface where variables can have varying dimensions between calls.
As a workaround, you can write a MATLAB file S-function that would construct the variable-dimension value for MFxxx field from the fixed-dimensions Simulink signal and call that S-function from the model. Note that MATLAB file S-Functions can not be used with Real-Time Workshop.