Simulink® 3D Animation™User's GuideR2015a
x Contents3D World Editor Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-243D World Editor Library Objects . . . . . . . . . . .
3 Simulink Interface3-184Select the Allow viewing from the Internet check box.Note This option allows any computer connected to the network to view yo
View Virtual World Remotely3-19Click OK. An IP Configuration dialog box opens with a list of your IP, mask, andgateway addresses.Alternatively, for W
3 Simulink Interface3-208On the host computer, in the Simulink window, from the Simulation menu, clickRun.On the client computer, the animation of the
View Virtual World Remotely3-2110On the host computer, in the Simulink window, from the Simulation menu, clickStop. On the client computer, close the
3 Simulink Interface3-22Working with VRML SensorsIn this section...“Add VRML Sensors to Virtual Worlds” on page 3-22“Interactive Mode” on page 3-23“Re
Working with VRML Sensors3-23Sensors DescriptionVisibilitySensor Detects visibility changes of a rectangular box as you navigate theworld.Interactive
3 Simulink Interface3-24nh = vrnode(wh, 'Grab_Sensor');% synchronize the translation fieldsync(nh, 'translation', 'on');
Working with VRML Sensors3-25ROUTE Grab_Sensor.translation_changed TO Ball.translation• You can use this method to input information from all VRML no
3 Simulink Interface3-26VR Source Block Input to Simulink ModelsThe VR Source reads values from virtual world fields specified in the Block Parameters
Interact with Generated Code3-27Interact with Generated CodeYou can have a virtual world that you create the Simulink 3D Animation productinteract wi
xiDefine and Reset Viewpoints . . . . . . . . . . . . . . . . . . . . . . . . . 7-30Reset Viewpoints . . . . . . . . . . . . . . . . . . . . . . . . .
4MATLAB InterfaceAlthough using the Simulink 3D Animation software with the Simulink interface is thepreferred way of working with the Simulink 3D Ani
4 MATLAB Interface4-2Create vrworld Object for a Virtual WorldTo connect MATLAB to a virtual world and to interact with that virtual world throughthe
Create vrworld Object for a Virtual World4-31Open MATLAB. In the MATLAB Command Window, typemyworld = vrworld('vrmount.wrl')The MATLAB Comm
4 MATLAB Interface4-4Open a Virtual World with MATLABOpening a virtual world lets you view the virtual world in a VRML viewer, scan itsstructure, and
Open a Virtual World with MATLAB4-53If the Web browser has the VRML plug-in installed, in the browser window, click Myfirst virtual world.4Your defau
4 MATLAB Interface4-6Interact with a Virtual World with MATLABIn the life cycle of a vrworld object you can set new values for all the available virtu
Interact with a Virtual World with MATLAB4-7mynodes = vrnode object: 13-by-1 Tunnel (Transform) [My first virtual world] Road (Shape) [My first virt
4 MATLAB Interface4-8 ----------------------------------------------------------- addChildren eventIn MFNode off remove
Close and Delete a vrworld Object4-9Close and Delete a vrworld ObjectAfter you are finished with a session, you must close all open virtual worlds an
xii ContentsView a Virtual World in Stereoscopic Vision . . . . . . . . . . . . 7-62Enable Stereoscopic Vision . . . . . . . . . . . . . . . . . . . .
4 MATLAB Interface4-10Animation RecordingIn this section...“Recording Formats” on page 4-10“Manual and Scheduled Animation Recording” on page 4-11The
Animation Recording4-11vrfigure objects to record 2-D animation files. The recorded 2-D animation reflectsexactly what you see in the viewer window.
4 MATLAB Interface4-12File Name TokensThe Simulink 3D Animation software supports a variety of file naming formats using filetokens. By default, the S
Define File Name Tokens4-13Define File Name TokensIn this section...“Default File Name Format” on page 4-13“Uses for File Name Tokens” on page 4-13De
4 MATLAB Interface4-14expect to create files of different parts of the model simulation. This feature allowsyou to capture a frame or run a Simulink m
File Name Tokens4-15File Name TokensThe following tokens are the same for frame capture (.tif or .png) or animation (.wrland .avi) files.Token Descri
4 MATLAB Interface4-16Token Description%Y The current four-digit year replaces this token in the file name string.For example, the format %f_anim_%Y.w
Manual 3-D VRML Recording with MATLAB4-17Manual 3-D VRML Recording with MATLABThis topic describes how to manually record a 3-D animation using the M
4 MATLAB Interface4-18set(myworld,'Record3D','on');5Run the Simulink model. From the Simulation menu, select Mode > Normal, the
Manual 2-D AVI Recording with MATLAB4-19Manual 2-D AVI Recording with MATLABThis topic describes how to manually record a 2-D animation using the MAT
xiiiBlocks — Alphabetical List9Functions — Alphabetical List10Glossary
4 MATLAB Interface4-20If the description string is unique, myworld is assigned the correct virtual world.4To retrieve the handle to the currently disp
Manual 2-D AVI Recording with MATLAB4-21The Simulink 3D Animation software stops recording the animation. The Simulink3D Animation software creates t
4 MATLAB Interface4-22Scheduled 3-D VRML Recording with MATLABThis topic describes how to schedule the recording of a 3-D animation using the MATLABin
Scheduled 3-D VRML Recording with MATLAB4-234Direct the Simulink 3D Animation software to record the animation on a schedule bysetting the RecordMode
4 MATLAB Interface4-24• From the keyboard, press Ctrl+T to stop the simulation.9Close and delete the objects if you do not want to continue using them
Scheduled 2-D AVI Recording with MATLAB4-25Scheduled 2-D AVI Recording with MATLABThis topic describes how to schedule the recording of a 2-D animati
4 MATLAB Interface4-263To retrieve the handle to the currently displayed Simulink 3D Animation Viewerfigure, typef=get(myworld,'Figures')4To
Scheduled 2-D AVI Recording with MATLAB4-27The simulation runs. The Simulink 3D Animation software starts recordingwhen the simulation time reaches t
4 MATLAB Interface4-28Record Animations for Unconnected Virtual WorldsThis topic describes how to programmatically record animation files for virtual
Record Animations for Unconnected Virtual Worlds4-291Retrieve the corresponding vrworld object.2Set the Record3D vrworld property.3To override defaul
4 MATLAB Interface4-30Because of the repetitive nature of the time interval setting, set the Time property ina loop from within a script or program.•
Play Animation Files4-31Play Animation FilesIn this section...“Play VRML Animation Files” on page 4-31“Play AVI Animation Files” on page 4-32Play VRM
4 MATLAB Interface4-32The vrview command displays the default Simulink 3D Animation Viewer for theanimation file. Setting the TimeSource property of t
5Build Virtual Reality WorldsThe Simulink 3D Animation product includes tools that you can use to edit and createVRML virtual worlds. A basic understa
5 Build Virtual Reality Worlds5-2VRML EditorsEditors for Virtual WorldsThere is more than one way to create a virtual world defined with VRML code. Fo
VRML Editors5-3• “Native VRML Editors” on page 5-4• “3D World Editor” on page 5-4Text EditorsA VRML file uses a standard text format that you can rea
5 Build Virtual Reality Worlds5-4General 3-D editing tools target specific types of work. For example, they can targetvisual art, animation, games, or
VRML Editors5-5• Tree structure pane — View the hierarchy for the virtual world that you are editing.The 3D World Editor lists the nodes and their pr
5 Build Virtual Reality Worlds5-6Ligos V-Realm BuilderThe Ligos V-Realm Builder interface is available only for Windows operating systems.The V-Realm
Build and Connect a Virtual World5-7Build and Connect a Virtual WorldIn this section...“Introduction” on page 5-7“Define the Problem” on page 5-7“Add
1Getting Started• “Simulink 3D Animation Product Description” on page 1-2• “Expected Background” on page 1-3• “Build Virtual Worlds to Visualize Dynam
5 Build Virtual Reality Worlds5-8The following table lists the positions and dimensions of the objects that you create forthis example.Object Center P
Build and Connect a Virtual World5-91 to 0.4, and the y and z dimensions are expanded so that the volume of the deformedsphere-ellipsoid remains cons
5 Build Virtual Reality Worlds5-104From the MATLAB Command Window, typevrlibThe Simulink 3D Animation library opens.5From the Library window, drag and
Build and Connect a Virtual World5-11• In the left pane, a VRML tree with only a ROOT node• In the right pane, an empty virtual world• In the bottom
5 Build Virtual Reality Worlds5-12aRight-click the Transform node.bSelect the Edit Name menu item.cIn the edit box to the left of the Transform node,
Build and Connect a Virtual World5-136Add a Material node to the Appearance node:aExpand the (Appearance) node and select the material(SFNode) node.
5 Build Virtual Reality Worlds5-14With all the nodes expanded, the 3D World Editor now displays a box in the virtualworld display pane.8Make the box s
Build and Connect a Virtual World5-15aSelect the size property of the Box node.bIn the object properties edit pane at the bottom of the 3D World Edit
5 Build Virtual Reality Worlds5-1610Add a second box that is very similar to the first box.aUnder the ROOT node, add a Transform node (see step 2) and
Build and Connect a Virtual World5-1711Move the box that you just created to the left by changing the translationproperty of the B2(Transform) node.
1 Getting Started1-2Simulink 3D Animation Product DescriptionAnimate, visualize, and interact with models in 3DSimulink 3D Animation provides apps for
5 Build Virtual Reality Worlds5-18Create a SphereYour next task is to add a sphere between the two boxes. This section assumes you havecompleted the t
Build and Connect a Virtual World5-195To make the sphere blue, under the Material node, select the diffuseColorproperty. In the object properties edi
5 Build Virtual Reality Worlds5-20Link to a Simulink ModelAfter you create a virtual world and a Simulink model, and add a VR Sink block to yourmodel,
Build and Connect a Virtual World5-2110Double-click the VR Sink block.The viewer appears.11Select the Simulation menu Block Parameters option. Your d
5 Build Virtual Reality Worlds5-2213In the Simulink window, from the Simulation menu, click Run.In your default viewer, you see a 3-D animation of the
Build and Connect a Virtual World5-23This example shows you how to create and use a very simple virtual reality model.Using the same method, you can
5 Build Virtual Reality Worlds5-24VRML Data TypesIn this section...“Section Overview” on page 5-24“VRML Field Data Types” on page 5-24“VRML Data Class
VRML Data Types5-25VRML Type Description Simulink 3D Animation TypeSFColor Vector of three floating-pointvalues you use for RGB colorspecification.Si
5 Build Virtual Reality Worlds5-26To ensure backward compatibility with existing models and applications, use theSimulink 3D Animation vrsetpref funct
VRML Data Types5-27eventInUsually, eventIn events correspond to a field in the node. Node fields are not accessiblefrom outside the node. The only wa
Expected Background1-3Expected BackgroundTo help you effectively read and use this guide, here is a brief description of the chaptersand a suggested
5 Build Virtual Reality Worlds5-28Simulink 3D Animation TexturesThe following are texture file recommendations for Simulink 3D Animation models:• Wher
Add Sound to a Virtual World5-29Add Sound to a Virtual WorldTo add sound to a virtual world, use a VRML Sound node. You can include anAudioClip node
5 Build Virtual Reality Worlds5-30Using CAD Models with the Simulink 3D Animation ProductIn this section...“Section Overview” on page 5-30“Import STL
Using CAD Models with the Simulink 3D Animation Product5-311In the 3D World Editor, select the Root node or an MFNode node (usually thechildren node
5 Build Virtual Reality Worlds5-32have VRML export filters, but there are conversion utilities available from third partiesif the export filter is not
Using CAD Models with the Simulink 3D Animation Product5-33Level of Detail ConsiderationsCAD models are usually parametric models that use proprietar
5 Build Virtual Reality Worlds5-34aircraft operation in space). For such navigation to be successful, the scene's author mustdefine the Navigatio
Using CAD Models with the Simulink 3D Animation Product5-35rotating support — arm — wrist — hand — toolSo when the rotating support moves, all other
5 Build Virtual Reality Worlds5-36If the pendulum dynamics model uses global coordinates for all moving parts, the VRMLmodel has a flat structure as s
Using CAD Models with the Simulink 3D Animation Product5-37If the pendulum dynamics model uses local coordinates for moving parts, thecorresponding V
1 Getting Started1-4Build Virtual Worlds to Visualize Dynamic SimulationsIn this section...“Virtual Reality World Models of Dynamic Systems” on page 1
5 Build Virtual Reality Worlds5-38Some third-party tools allow you to export each part of the assembly into separate VRMLfiles. All parts are then ref
Using CAD Models with the Simulink 3D Animation Product5-39• “Wrap Shape Objects with Transforms” on page 5-39• “Add DEF Names” on page 5-39Wrap Shap
5 Build Virtual Reality Worlds5-40DEF Robot_Arm1 Transform { children [ Inline { url ["robot_arm1.wrl"]
Using CAD Models with the Simulink 3D Animation Product5-41objects in the scene hierarchy. For an example of a viewpoint moving with theobject, see t
5 Build Virtual Reality Worlds5-421From the vrlib library, insert a VR Sink block into your Simulink model.2Double-click the VR Sink block to open the
Using CAD Models with the Simulink 3D Animation Product5-43For converting such rotations into the VRML format, use the Rotation Matrix to VRMLRotatio
5 Build Virtual Reality Worlds5-44center of rotation to coincide with the joint connecting thehand and the tool in the hand’s local coordinates.In a h
Using CAD Models with the Simulink 3D Animation Product5-45a three-component vector in the VR Sink block. The remaining vector elements are filledwit
5 Build Virtual Reality Worlds5-46appropriate coordinate systems attached to the bodies, with positions and rotationsdefined using global coordinates.
Using CAD Models with the Simulink 3D Animation Product5-47When exporting products, the CATIA software creates one compound VRML file thatcontains al
Build Virtual Worlds to Visualize Dynamic Simulations1-5Simulink, or SimMechanics. If your computer does not already have a graphics cardwith hardwar
5 Build Virtual Reality Worlds5-48You can achieve best results by using the proportional method of tessellation (arcsare substituted by line segments
Using CAD Models with the Simulink 3D Animation Product5-49these elements have synthetic DEF names (for example, _0161DC70). For the most part,you wi
5 Build Virtual Reality Worlds5-50• CylinderSleeve1• PistonAssembly1• CrankshaftAssembly1The export does not preserve the CATProduct and CATPart names
Using CAD Models with the Simulink 3D Animation Product5-51• The main Transform representing the CATIA product is always scaled by a factorof 0.001 (
5 Build Virtual Reality Worlds5-52Do not adjust parts in the scene that you do not want to control from the MATLABenvironment.• Scaling of VRML Object
6Using the 3D World Editor• “3D World Editor” on page 6-2• “Open the 3D World Editor” on page 6-5• “3D World Editor Panes” on page 6-7• “Create a Virt
6 Using the 3D World Editor6-23D World EditorIn this section...“Supported Platforms” on page 6-2“Use with Other Editors” on page 6-2“VRML Support” on
3D World Editor6-3For general VRML limitations relating to the Simulink 3D Animation software as awhole, see “VRML Compatibility”.PixelTexture NodesY
6 Using the 3D World Editor6-4To access templates, use one of the following approaches:• Select File > New From Template.•Select the New File From
Open the 3D World Editor6-5Open the 3D World EditorIn this section...“3D World Editor Is the Default Editor” on page 6-5“Open an Empty Virtual World”
How to Contact MathWorksLatest news:www.mathworks.comSales and services:www.mathworks.com/sales_and_servicesUser community:www.mathworks.com/matlabcen
1 Getting Started1-6Invalid MEX-file 'matlab/toolbox/sl3d/sl3d/vrsfunc.mexglx':libGL.so: cannot open shared object file If you see an error
6 Using the 3D World Editor6-6Open a Saved Virtual WorldUse one of these approaches to open a saved virtual world.• From the MATLAB Current Folder pan
3D World Editor Panes6-73D World Editor PanesThe 3D World Editor provides three panes:• Tree structure pane — View the hierarchy for the virtual worl
6 Using the 3D World Editor6-8elements are called nodes. The 3D World Editor lists the nodes and their propertiesaccording to their respective VRML no
Create a Virtual World6-9Create a Virtual WorldThere are a number of tasks involved in creating a virtual world. You can use the 3DWorld Editor throu
6 Using the 3D World Editor6-10• You can use Orbisnap to view library objects to determine which objects you wantto insert into the virtual world.7In
Basic Editing6-11Basic EditingIn this section...“Add Objects” on page 6-11“Copy and Paste a Node” on page 6-12“Edit Object Properties” on page 6-13“D
6 Using the 3D World Editor6-12Approach Procedure2Select Nodes > Add.3Select appropriate submenus to add the node thatyou want.Use a context menu f
Basic Editing6-13• An explicit text copy allows you to edit properties of that node, independently fromthe original node that you copied.• A referenc
6 Using the 3D World Editor6-14Set Viewpoint Values in the 3D World Editor Based on Camera PositionYou can use the current camera position to interact
Basic Editing6-15Document a Virtual World Using CommentsTo document a virtual world, in the object property edit pane, use the Comments tabfor nodes
Build Virtual Worlds to Visualize Dynamic Simulations1-7• Simulink model• SimMechanics model• MATLAB virtual world objectSimulinkThe Simulink 3D Anim
6 Using the 3D World Editor6-16Wrap Nodes as Children of Another NodeTo wrap contiguous nodes as children of another node:1Select the nodes. You can u
Basic Editing6-17• On the toolbar, click the scissors button.• Select Edit > Cut.• Right-click the node and select Cut.Save and Export Virtual Wo
6 Using the 3D World Editor6-182Select the appropriate Add Interface Item menu option.The following is an example of a Script node in the Tree structu
Reduce Number of Polygons for Shapes6-19Reduce Number of Polygons for ShapesFor a node that is, or includes, an IndexedFaceSet node, you can improve
6 Using the 3D World Editor6-20Virtual World Navigation in 3D World EditorIn this section...“Specify Virtual World Rendering” on page 6-20“Basic Navig
Virtual World Navigation in 3D World Editor6-21To hide the triad for a virtual world, or to change the location of the triad in the virtualworld disp
6 Using the 3D World Editor6-22You can also use toolbar buttons to set view panes:When the grid view panes are open, if you change the view pane optio
Virtual World Navigation in 3D World Editor6-23Pivot PointIn Examine mode, you can use a pivot point for rotating a virtual world around a point,usin
6 Using the 3D World Editor6-243D World Editor LibraryIn this section...“3D World Editor Library Objects” on page 6-24“Add a Library Object” on page 6
3D World Editor Library6-25• The first Transform node of the file that you select from another location is insertedin place into the tree view of the
1 Getting Started1-8From the MATLAB software, you can set positions and properties of VRML objects,create callbacks from graphical interfaces, and map
7Viewing Virtual Worlds• “VRML Viewers” on page 7-2• “Simulink 3D Animation Viewer” on page 7-4• “Open the Simulink 3D Animation Viewer” on page 7-8•
7 Viewing Virtual Worlds7-2VRML ViewersIn this section...“Host and Remote Viewing” on page 7-2“Sound” on page 7-3“Comparison of Viewers” on page 7-3“L
VRML Viewers7-3SoundOther Web viewers may allow for sound playback, but are not officially supported. To addsound to a virtual world, you can include
7 Viewing Virtual Worlds7-4Simulink 3D Animation ViewerIn this section...“What You Can Do with the Viewer” on page 7-4“Viewer Uses MATLAB Figures” on
Simulink 3D Animation Viewer7-51Select a Simulink 3D Animation example and type that example’s name in theMATLAB Command Window. For example:vrpendTh
7 Viewing Virtual Worlds7-6Note The Simulink 3D Animation viewer settings are saved when you save yourmodel file.Viewer Uses MATLAB FiguresThe Simulin
Simulink 3D Animation Viewer7-7• Treat the viewer window like a MATLAB figure. This ability enables you to performMATLAB figure actions such as dock
7 Viewing Virtual Worlds7-8Open the Simulink 3D Animation ViewerIn this section...“Open from the VR Sink Block” on page 7-8“Open from the Command Line
Simulate with the Simulink 3D Animation Viewer7-9Simulate with the Simulink 3D Animation ViewerYou can start and stop simulations of the virtual worl
Build Virtual Worlds to Visualize Dynamic Simulations1-9Simulink 3D Animation software is running. This allows others to view an animatedvirtual worl
7 Viewing Virtual Worlds7-10Specify Rendering TechniquesYou can change the rendering of the scene through the controls on the navigation panelor optio
Specify Rendering Techniques7-11You can turn the camera headlight and the lighting of the scene on or off. WhenHeadlight is off, the camera does not
7 Viewing Virtual Worlds7-12Note It is helpful to define enough lighting within the virtual scene so that it is litregardless of the Headlight setting
Specify Rendering Techniques7-13If Transparency is off, transparent objects are rendered as solid objects.
7 Viewing Virtual Worlds7-14Turning Wireframe on changes the scene's objects from solid to wireframe rendering.The following is the vrpend exampl
Specify Rendering Techniques7-15If Textures is on, objects have texture in the virtual scene. The following is thevrplanets example with Textures on.
7 Viewing Virtual Worlds7-16If Textures is off, objects do not have texture in the virtual scene. The following is thevrplanets example with Textures
Specify Rendering Techniques7-17You can specify the maximum size of a texture used in rendering the vrfigure object.This option gives you a list of t
7 Viewing Virtual Worlds7-18Navigate Using the Simulink 3D Animation ViewerIn this section...“Basic Navigation” on page 7-18“Navigation Panel” on page
Navigate Using the Simulink 3D Animation Viewer7-19Navigation methods — Navigation with the mouse depends on the navigation methodthat you select and
1 Getting Started1-10Virtual Reality Modeling Language (VRML)In this section...“VRML History” on page 1-10“VRML Support” on page 1-11“VRML Compatibili
7 Viewing Virtual Worlds7-20From the menu bar, select the View menu Navigation Zones option. The virtualscene changes as the navigation zones are togg
Navigate Using the Simulink 3D Animation Viewer7-21If you have multiple viewers open, the navigation panel in the active viewer is blue.Minimize the
7 Viewing Virtual Worlds7-22Viewer Keyboard ShortcutsNavigation Function Keyboard ShortcutUse full-screen mode. Ctrl+fUndo move. BackspaceStart or sto
Navigate Using the Simulink 3D Animation Viewer7-23Navigation Function Keyboard ShortcutPressing Ctrl alone acquires the examine lockat the point of
7 Viewing Virtual Worlds7-24If your virtual world contains sensors, these sensors take precedence over mousenavigation at the sensor's location.
Navigate Using the Simulink 3D Animation Viewer7-252In the Simulink Editor window, from the Simulation menu, choose Run.The example starts running.3C
7 Viewing Virtual Worlds7-26parallel with global x, y, and z coordinate axes. As you navigate in a virtual world, thetriad display changes to reflect
Navigate Using the Simulink 3D Animation Viewer7-27To set the pivot point in a virtual world, hold CRTL and double-click the spot where youwant the p
7 Viewing Virtual Worlds7-28ViewpointsVisitors to your virtual world are navigating in an environment you create for them,using navigation methods all
Viewpoints7-29• Dynamic -- Created as children of moving objects (objects controlled from MATLABor Simulink) or linked to moving objects with the VRM
Virtual Reality Modeling Language (VRML)1-11VRML97 represents an open and flexible platform for creating interactive three-dimensional scenes (virtua
7 Viewing Virtual Worlds7-30Define and Reset ViewpointsIn this section...“Reset Viewpoints” on page 7-30“Define Viewpoints” on page 7-30Reset Viewpoin
Define and Reset Viewpoints7-31In the Simulink 3D Animation viewer, the default viewpoint for this model is Viewfrom top.2From the menu bar, choose t
7 Viewing Virtual Worlds7-3213Repeat steps 2 to 6.14In the Placement field, select Sibling of the current viewpoint. This optioncreates a new viewpoin
Define and Reset Viewpoints7-33
7 Viewing Virtual Worlds7-34Navigate Through ViewpointsYou can navigate through a virtual scene's viewpoints using the menu bar, toolbar,navigati
Navigate Through Viewpoints7-353Select the drop-down list on the leftmost side of the toolbar to see the list of existingviewpoints from the toolbar.
7 Viewing Virtual Worlds7-36When you add new viewpoints to the world, these lists are updated to reflect the newviewpoints.The current viewpoint is al
Navigate Through Viewpoints7-37• Go to the virtual world's default viewpoint• Create and remove viewpoints• Navigate to an existing viewpoint
7 Viewing Virtual Worlds7-38Record Offline AnimationsIn this section...“Animation Recording” on page 7-38“Recording Formats” on page 7-38“File Names”
Record Offline Animations7-39• 3-D VRML file — The Simulink 3D Animation software traces object movementsand saves that data into a VRML file using V
1 Getting Started1-12The software analyzes the structure of the virtual world, determines what signals areavailable, and makes them available from the
7 Viewing Virtual Worlds7-40associated with the model and %n is a number that increments each time you record asimulation for the same virtual world.
Record Offline Animations7-411In the MATLAB Command Window, type the model name. For example:vrplanetsThe Simulink model is displayed. Also, by defau
7 Viewing Virtual Worlds7-42Record Files in the Audio Video Interleave (AVI) FormatTo create a 2-D AVI format file from a Simulink model execution, se
Record Offline Animations7-43Set FPS to auto if you want to use the sample time of the associated VR Sink blockto make the file playback correspond t
7 Viewing Virtual Worlds7-44quality numbers result in lower video quality and smaller file sizes. You need tospecify an identification string of a cod
Record Offline Animations7-453From the Record mode list, choose Scheduled.The Start time and Stop time text fields are enabled.4Enter in Start time a
7 Viewing Virtual Worlds7-46Ensure that the recording start time value is not earlier than the start time of theSimulink model; the recording operatio
Play Animations with Simulink 3D Animation Viewer7-47Play Animations with Simulink 3D Animation ViewerYou can use the Simulink 3D Animation You can a
7 Viewing Virtual Worlds7-48Configure Frame Capture ParametersThis topic describes how to configure and capture a frame, using the vrplanets exampleas
Capture Frames7-49Capture FramesThe Simulink 3D Animation product allows you to save a frame snapshot (capture) ofthe current Simulink 3D Animation v
Virtual Reality Modeling Language (VRML)1-13VRML Coordinate System
7 Viewing Virtual Worlds7-50Simulink 3D Animation Web ViewerUse the Simulink 3D Animation Web Viewer to access virtual worlds with an HTML5-enabled We
Open the Web Viewer7-51Open the Web ViewerIn this section...“Set Up for Remote Viewing” on page 7-51“Connect the Web Viewer” on page 7-51Set Up for R
7 Viewing Virtual Worlds7-52Note: If you need to change the HTTP port (for example, if a firewall blocks a port),set a different port number and resta
Navigate Using the Web Viewer7-53Navigate Using the Web ViewerIn this section...“Display and Navigation” on page 7-53“Keyboard Shortcuts” on page 7-5
7 Viewing Virtual Worlds7-54Navigation Function Keyboard ShortcutReturn to current viewpoint. RGo to previous viewpoint. Page UpGo to next viewpoint.
Navigate Using the Web Viewer7-55• Figure > Appearance > Navigation zonesTo access the preferences, from the MATLAB Toolstrip, in the Home tab,
7 Viewing Virtual Worlds7-56Legacy Simulink 3D Animation ViewerIn this section...“Introduction” on page 7-56“Starting the Legacy Viewer” on page 7-56“
Legacy Simulink 3D Animation Viewer7-57 DefaultFigureMaxTextureSize: 'auto' DefaultFigureNavPanel: 'ha
7 Viewing Virtual Worlds7-58To revert to the original default viewer, typevrsetpref('DefaultViewer','internal') Differences Betwee
Legacy Simulink 3D Animation Viewer7-59• In the legacy viewer, you cannot combine multiple figures in several tiles of aMATLAB figure.The legacy and
1 Getting Started1-14The VRML coordinate system is different from the MATLAB and Aerospace Blockset™coordinate systems. VRML uses the world coordinate
7 Viewing Virtual Worlds7-60Listen to Sound in a Virtual WorldIn this section...“System Requirements for Sound” on page 7-60“Listen to Sound” on page
Listen to Sound in a Virtual World7-61For a vr.canvas object, to disable sound , set the Sound property to 'off'.To control volume, use you
7 Viewing Virtual Worlds7-62View a Virtual World in Stereoscopic VisionIn this section...“Enable Stereoscopic Vision” on page 7-62“Control Stereoscopi
View a Virtual World in Stereoscopic Vision7-63Control Stereoscopic EffectsYou can control the following stereoscopic effects interactively or using
7 Viewing Virtual Worlds7-64Active Stereoscopic Vision ConfigurationIn this section...“Computer Platforms” on page 7-64“Graphics Cards” on page 7-64“D
Active Stereoscopic Vision Configuration7-65• 3D television set that displays 3D content. For stereoscopic vision, you typically useactive shutter gl
8Simulink 3D Animation Stand-AloneViewerThe Simulink 3D Animation stand-alone viewer, Orbisnap, allows you to visualize virtualworlds or prerecorded a
8 Simulink 3D Animation Stand-Alone Viewer8-2Orbisnap ViewerWhat is Orbisnap?The Simulink 3D Animation product includes Orbisnap. Orbisnap is a free,
Install Orbisnap8-3Install OrbisnapIn this section...“Section Overview” on page 8-3“System Requirements” on page 8-3“Copying Orbisnap to Another Loca
Virtual Reality Modeling Language (VRML)1-15gives you a good understanding of how the virtual world elements can be controlled usingSimulink 3D Anima
8 Simulink 3D Animation Stand-Alone Viewer8-4Adding Shortcuts or Symbolic LinksFor convenience, you can create a shortcut (Windows) or symbolic link (
Start Orbisnap8-5Start OrbisnapYou can start Orbisnap from any command line with the following:orbisnaporbisnap -f vr_filenameorbisnap -c hostname -w
8 Simulink 3D Animation Stand-Alone Viewer8-6Orbisnap InterfaceIn this section...“Menu Bar” on page 8-8“Toolbar” on page 8-9“Navigation Panel” on page
Orbisnap Interface8-7Orbisnap provides much of the functionality of the Simulink 3D Animation Viewer.Using the menu bar, toolbar, and navigation pane
8 Simulink 3D Animation Stand-Alone Viewer8-8• Customize the Orbisnap window• Manage virtual world viewpoints• Manage scene renderingYou cannot• Open
Orbisnap Interface8-9• Navigation Panel — Controls the display of the navigation panel, includingtoggling it.• Triad — Shows red, green, and blue arr
8 Simulink 3D Animation Stand-Alone Viewer8-10• Hide panel — Toggles the navigation panel.• Full-screen mode— Uses the whole screen for Orbisnap.• Nex
Navigate Using Orbisnap8-11Navigate Using OrbisnapYou can navigate around a virtual world using the menu bar, toolbar, navigation panel,mouse, and ke
8 Simulink 3D Animation Stand-Alone Viewer8-12Movement Mode Zone and DescriptionExamine Outer -- Click and drag the mouse up and down to move forwarda
Navigate Using Orbisnap8-13Keyboard Command Navigation FunctionEsc Go to default viewpoint.Home Return to current viewpoint.Page Up, Page Down Move b
Revision HistoryAugust 2001 First printing New for Version 2.0 (Release 12.1)July 2002 Second printing Revised for Version 3.0 (Release 13)October 200
1 Getting Started1-16# This is a comment lineWorldInfo { title "Bouncing Ball" }Viewpoint { position 0 5 30 description "Side View&
8 Simulink 3D Animation Stand-Alone Viewer8-14View Animations or Virtual Worlds with OrbisnapThis topic assumes that you have a prerecorded WRL animat
View Virtual Worlds Remotely with Orbisnap8-15View Virtual Worlds Remotely with OrbisnapTo view virtual worlds from the Simulink 3D Animation server
8 Simulink 3D Animation Stand-Alone Viewer8-163Enter the IP address or hostname of the host computer running the Simulink 3DAnimation server (127.0.0.
View Virtual Worlds Remotely with Orbisnap8-174Select a virtual world.5Click OK.Orbisnap displays the selected virtual world of the remote Simulink 3
9Blocks — Alphabetical List
9 Blocks — Alphabetical List9-2Cross ProductCross product of two 3-D vectorsLibrarySimulink 3D AnimationDescriptionTakes two 3-by-1 vectors as input a
Joystick Input9-3Joystick InputProcess input from asynchronous joystick deviceLibrarySimulink 3D AnimationDescriptionThe Joystick Input block provide
9 Blocks — Alphabetical List9-4Block Parameters Dialog BoxJoystick ID — The system ID assigned to the given joystick device. You can find thepropertie
Joystick Input9-5Output Port Value DescriptionAxes Vector of doubles in the range <-1; 1 >Outputs correspond to thecurrent position of the joys
Virtual Reality Modeling Language (VRML)1-17
9 Blocks — Alphabetical List9-6Normalize VectorUnit vector parallel to input vectorLibrarySimulink 3D AnimationDescriptionTakes an input vector of any
Rotation Between 2 Vectors9-7Rotation Between 2 VectorsVRML rotation between two 3-D vectorsLibrarySimulink 3D AnimationDescriptionTakes input of two
9 Blocks — Alphabetical List9-8Rotation Matrix to VRML RotationConvert rotation matrix into representation used in VRMLLibrarySimulink 3D AnimationDes
Rotation Matrix to VRML Rotation9-9Rotation MatrixA representation of a three-dimensional spherical rotation as a 3-by-3 real, orthogonalmatrix R: RT
9 Blocks — Alphabetical List9-10Space Mouse InputProcess input from space mouse deviceLibrarySimulink 3D AnimationDescriptionA space mouse is a device
Space Mouse Input9-11Block Parameters Dialog Box
9 Blocks — Alphabetical List9-12Port — Serial port to which the space mouse is connected. Possible values areUSB1...USB4 and COM1...COM4.Output Type —
Space Mouse Input9-13Upper position limit — Position coordinates for the upper limit of the mouse.See AlsoManipulator with SpaceMouse
9 Blocks — Alphabetical List9-14Viewpoint Direction to VRML OrientationConvert viewpoint direction to VRML orientationLibrarySimulink 3D AnimationDesc
VR Placeholder9-15VR PlaceholderSend unspecified value to Simulink 3D Animation blockLibrarySimulink 3D AnimationDescriptionThe VR Placeholder block
1 Getting Started1-18Virtual Reality World and Dynamic System ExamplesIn this section...“Simulink Interface Examples” on page 1-18“MATLAB Interface Ex
9 Blocks — Alphabetical List9-16Block Parameters Dialog BoxOutput Width — Length of the vector containing placeholder signal values.
VR Signal Expander9-17VR Signal ExpanderExpand input vectors into fully qualified VRML field vectorsLibrarySimulink 3D AnimationDescriptionThe VR Sig
9 Blocks — Alphabetical List9-18Block Parameters Dialog BoxOutput width — How long the output vector should be.Output signal indices — Vector indicati
VR Sink9-19VR SinkWrite data from Simulink model to virtual worldLibrarySimulink 3D AnimationDescriptionThe VR Sink block writes values from its port
9 Blocks — Alphabetical List9-20Desktop Real-Time, some sink blocks and Sim Viewing Device blocks stay in Normalmode during simulation, receive data f
VR Sink9-21Source file — VRML file name specifying the virtual world that connects to this block.By default, the full path to the associated .wrl fil
9 Blocks — Alphabetical List9-22Nodes that have names are marked with red arrows. You can access them from theSimulink 3D Animation interface. Nodes w
VR Source9-23VR SourceRead data from virtual world to Simulink modelLibrarySimulink 3D AnimationDescriptionThe VR Source provides access to virtual w
9 Blocks — Alphabetical List9-24window opens with the same parameters that were saved, such as position, size, andnavigation mode. When closing the vi
VR Source9-25Source file — VRML file name specifying the virtual world that connects to this block.By default, the full path to the associated .wrl f
Virtual Reality World and Dynamic System Examples1-19The following table lists the Simulink examples provided with the Simulink 3DAnimation product.
9 Blocks — Alphabetical List9-26SFxxx field that can map to a variable-size signal. For details about these data types, see“VRML Field Data Types”.Not
VR Text Output9-27VR Text OutputAllows display of Simulink signal values as text in VRML sceneLibrarySimulink 3D AnimationDescriptionThe VR Text Outp
9 Blocks — Alphabetical List9-28Block Parameters Dialog BoxAssociated VRML file — VRML file specifying the virtual world to which text isoutput.Associ
VR Text Output9-29string is recycled through the components of the input vector. This block does not supportthe %c and %s conversion formats, as sign
9 Blocks — Alphabetical List9-30VR To VideoWrite data from Simulink model to virtual world (video output port enabled)LibrarySimulink 3D AnimationDesc
VR Tracer9-31VR TracerTrace trajectory of object in associated virtual sceneLibrarySimulink 3D AnimationDescriptionTrace the trajectory of an object
9 Blocks — Alphabetical List9-32Block Parameters Dialog BoxFollowing is the Main pane of the VR Tracer block dialog box.
VR Tracer9-33
9 Blocks — Alphabetical List9-34Following is the Marker Projections pane of the VR Tracer block dialog box.Associated VRML file — VRML file name speci
VR Tracer9-35• Pyramid• Box• Octahedron• SphereConnect markers with line segments — Select this check box to connect the tracedobject path with lines
1 Getting Started1-20Bouncing Ball Example (vrbounce)The vrbounce example represents a ball bouncing from a floor. The ball deforms as ithits the floo
9 Blocks — Alphabetical List9-36to project the position of the object. The coefficients are in the form ax+by+cz+d=0.For example, if you use the defau
10Functions — Alphabetical List
10 Functions — Alphabetical List10-2stl2vrmlConvert STL files to VRML formatSyntaxstl2vrml(source)stl2vrml(source,destination)Descriptionstl2vrml(sour
stl2vrml10-3destination(Optional) Folder in which to create converted files. If the destination folder does notexist, stl2vrml attempts to create the
10 Functions — Alphabetical List10-4need to add lights, viewpoints, and surrounding objects, modify part materials, definenavigation speeds, or make o
vrcadcleanup10-5vrcadcleanupClean up VRML file exported from CAD toolsSyntaxvrcadcleanup('filename')vrcadcleanup('filename', &apo
10 Functions — Alphabetical List10-6The function also performs the following:• Upon output, discards any additional nodes, including transform nodes,
vr.canvas class10-7vr.canvas classCreate virtual reality canvasDescriptionCreate a virtual reality canvas.ConstructionvirtualCanvas = vr.canvas(world
10 Functions — Alphabetical List10-8parent — Figure or uipanel for displaying canvasfigure object | uipanel objectFigure or uipanel for displaying the
vr.canvas class10-9Smooth textures using antialising, specified as 'on' or 'off'. Antialiasing smoothstextures by interpolating v
Virtual Reality World and Dynamic System Examples1-21Portal Crane with Joystick Control (vrcrane_joystick)The vrcrane_joystick example illustrates ho
10 Functions — Alphabetical List10-10Headlight from camera, specified as 'on' or 'off'. If you specify 'off', the camera
vr.canvas class10-11'NavZones' — Display navigation zones'off' (default) | 'on'Navigation zones display, specified as &
10 Functions — Alphabetical List10-12Data Types: int32'Stereo3DCameraOffset' — Distance of left and right camera for stereoscopic visionnon-
vr.canvas class10-13'Units' — Units for Position property'pixels' (default) | 'normalized'Units for Position property,
10 Functions — Alphabetical List10-14Camera movement with the current viewpoint, returned as 'on' or 'off'.CameraDirection — Camer
vr.canvas class10-15ExaminePivotPoint — Pivot point about which camera rotates in examine navigationmodevector of three doublesPivot point about whic
10 Functions — Alphabetical List10-16NavZones — Display navigation zones'off' (default) | 'on'Navigation zones display, returned a
vr.canvas class10-17Stereoscopic vision mode, returned as 'off', 'anaglyph', 'active' or avr.utils.stereo3d object.Spec
10 Functions — Alphabetical List10-18Transparency effect, returned as 'on' or 'off'.Triad — Triad location'bottomleft' (
vr.canvas class10-19ExamplesCreate a Canvas That Displays in a FigureCreate and open a vrworld object.myWorld = vrworld('vrlights.wrl');ope
1 Getting Started1-22Portal Crane with Predefined Trajectory Example (vrcrane_traj)The vrcrane_traj example is based on the vrcrane_joystick example,
10 Functions — Alphabetical List10-20Create a Canvas in a UipanelCreate a figure.pf = figure;Create a uipanel in the figure and specify a title.pp1 =
vr.canvas class10-21Create a canvas in the uipanel.c = vr.canvas(w,pp1);Set Property Values of CanvasSet the camera direction, navigation mode, and s
10 Functions — Alphabetical List10-22myStereo3D = vr.utils.stereo3d.ANAGLYPH_RED_CYAN;Create a canvas. Define non-default values for some properties.m
vr.canvas class10-23• “Create vrworld Object for a Virtual World”• “MATLAB Interaction”• “View a Virtual World in Stereoscopic Vision”See Alsovr.util
10 Functions — Alphabetical List10-24captureClass: vr.canvasCapture virtual reality canvas imageSyntaximage_capture = capture(canvas)Descriptionimage_
capture10-25lights_world = vrworld('vrlights.wrl');open(lights_world);Create a vr.canvas object for lights_world.c = vr.canvas(lights_world
10 Functions — Alphabetical List10-26vrclearRemove all closed virtual worlds from memorySyntaxvrclearvrclear('-force')DescriptionThe vrclear
vrclose10-27vrcloseClose virtual reality figure windowsSyntaxvrclosevrclose allDescriptionvrclose and vrclose all close all the open virtual reality
10 Functions — Alphabetical List10-28vrdir2oriConvert viewpoint direction to orientationSyntaxvrdir2ori(d)vrdir2ori(d,options)Descriptionvrdir2ori(d)
vrdrawnow10-29vrdrawnowUpdate virtual worldSyntaxvrdrawnowDescriptionvrdrawnow removes from the queue pending changes to the virtual world and makest
Virtual Reality World and Dynamic System Examples1-23For more details on how to read values from virtual worlds programmatically, see“Working with VR
10 Functions — Alphabetical List10-30vreditOpen 3D World EditorSyntaxw = vreditw = vredit(filename)Descriptionw = vredit opens the 3D World Editor wit
vrfigure class10-31vrfigure classCreate virtual reality figureDescriptionCreates a virtual reality figure.To access vrfigure properties, use the vrfi
10 Functions — Alphabetical List10-32Position — Figure location and sizevector with four elementsLocation and size of virtual figure, specified as the
vrfigure class10-33capture Capture virtual reality figure imageclose Close virtual reality figureget Return property value of vrfigure objectisval
10 Functions — Alphabetical List10-34• “Create vrworld Object for a Virtual World”• “MATLAB Interaction”• “View a Virtual World in Stereoscopic Vision
vrfigure class10-35See Alsovr.utils.stereo3d class | vr.canvas classIntroduced before R2006a
10 Functions — Alphabetical List10-36captureClass: vrfigureCapture virtual reality figure imageSyntaximage_capture = capture(figure)Descriptionimage_c
capture10-37myworld = vrworld('vrmount.wrl');open(myworld);View the virtual world in the Simulink 3D Animation Viewer.f = vrfigure(myworld)
10 Functions — Alphabetical List10-38closeClass: vrfigureClose virtual reality figureSyntaxclose(figure)Descriptionclose(figure) closes the virtual re
close10-39Introduced before R2006a
1 Getting Started1-24The VRML model represents a nuclear hot chamber manipulator. It is manipulated by asimple Simulink model containing the Space Mou
10 Functions — Alphabetical List10-40getClass: vrfigureReturn property value of vrfigure objectSyntaxget(figure)figureProp = get(figure,propertyName)D
get10-41vrfigure Property MeaningCameraDirectionAbs Camera direction in the world coordinates.(read-only property).CameraPosition Camera position in
10 Functions — Alphabetical List10-42vrfigure Property MeaningRecord2DCompressMethodCompression method for creating 2-D animation files. See profile i
get10-43vrfigure Property MeaningWorld Virtual world that the figure displays(read-only property).ZoomFactor Camera zoom factor.Output Argumentsfigur
10 Functions — Alphabetical List10-44 DeleteFcn: '' ExaminePivotPoint: [0 0 0] Fullscreen: 'o
get10-45VR Car in the Mountains• “MATLAB Interaction”• “Create vrworld Object for a Virtual World”• “View a Virtual World in Stereoscopic Vision”See
10 Functions — Alphabetical List10-46isvalidClass: vrfigureCheck validity of vrfigure object handlesSyntaxvalid_handles = isvalid(vrfigure_vector)Desc
isvalid10-47ExamplesCheck Validity of Figure HandlesCheck whether the figure handles of the vrfigure object are valid. The first checkshows that the
10 Functions — Alphabetical List10-48setClass: vrfigureSet property values of vrfigure objectSyntaxset(figure,PropertyName,Value,...,PropertyName,Valu
set10-49'CameraBound' — Camera movement with current viewpoint'on' (default) | 'off'Camera movement with the current vi
Virtual Reality World and Dynamic System Examples1-25• Simple collision detection• Simulation of haptic effectsThe VR Source block supports using glo
10 Functions — Alphabetical List10-50'Fullscreen' — Fullscreen display of figure'off' (default) | 'on'Fullscreen display
set10-51Navigation mode, specified as 'examine', 'fly', 'walk', or 'none'. See “MouseNavigation”.'NavPan
10 Functions — Alphabetical List10-52Example: [230 250 570 510]Data Types: double'Record2D' — 2-D offline animation file recording'off&
set10-53Sound effects, specified as 'on' or 'off'.'StatusBar' — Status bar display'on' (default) | 'off&
10 Functions — Alphabetical List10-54'Toolbar' — Toolbar display'on' (default) | 'off'Toolbar display, specified as &apo
set10-55myworld = vrworld('vrmount.wrl');open(myworld);virtual_fig = vrfigure(myworld);Create a vr.utils.stereo3d object to use to specify
10 Functions — Alphabetical List10-56 Record2DFileName = '%f_anim_%n.avi' Sound = 'on' StatusBar = 'on' Stereo3D = &apos
vrgcbf10-57vrgcbfCurrent callback vrfigure objectSyntaxf = vrgcbfDescriptionf = vrgcbf returns a vrfigure object representing the virtual reality fig
10 Functions — Alphabetical List10-58vrgcfHandle for active virtual reality figureSyntaxh = vrgcfDescriptionh = vrgcf returns the handle of the curren
vrgetpref10-59vrgetprefValues of Simulink 3D Animation preferencesSyntaxx = vrgetprefx = vrgetpref('preference_name')x = vrgetpref('pr
1 Getting Started1-26capability, you can perform massive color changes or morphing. This model morphs acube into an octahedron and then changes it bac
10 Functions — Alphabetical List10-60Preference DescriptionDataTypeBool Specifies the handling of the VRML Bool datatype for vrnode/setfield and vrnod
vrgetpref10-61Preference DescriptionDefaultCanvasNavPanel Controls the appearance of the control panel inthe vr.canvas object. Values are:• 'non
10 Functions — Alphabetical List10-62Preference DescriptionDefaultFigureMaxTextureSizeSpecifies the default maximum size of a textureused in rendering
vrgetpref10-63Preference DescriptionDefaultFigureStatusBar Specifies whether the status bar appearsby default at the bottom of the Simulink 3DAnimati
10 Functions — Alphabetical List10-64Preference DescriptionDefaultViewer Specifies which viewer is used to view a virtualscene.• 'internal'D
vrgetpref10-65Preference DescriptionDefaultWorldRemoteView Specifies whether the virtual world is enabledby default for remote viewing for new vrworl
10 Functions — Alphabetical List10-66The HttpPort, VrPort, and TransportBuffer preferences affect Web-based viewingof virtual worlds. DefaultFigurePos
vrgetpref10-67%matlabroot Refers to the MATLAB root folder%file Refers to the VRML file nameFor instance, a possible value for the Editor preference
10 Functions — Alphabetical List10-68vrifs2patchConvert VRML IndexedFaceSet nodes to MATLAB patchesSyntaxvrifs2patch(ifs)Descriptionvrifs2patch(ifs) c
vrifs2patch10-69Convert the IndexedFaceSet a MATLAB patch and show it.set(vrfig1,'CameraUpVector',[0 0 -1]);figure('Name',...
Virtual Reality World and Dynamic System Examples1-27objects. In this case, the virtual world displays three graphs that update at each majorsimulati
10 Functions — Alphabetical List10-70Change the patch color, show the axes grid, rotate the camera, and enable mouserotation.tp.FaceColor = 'red&
vrifs2patch10-71More About• “Introduction to Patch Objects”See Alsopatch | vrpatch2ifsIntroduced in R2015a
10 Functions — Alphabetical List10-72vrinstallInstall and check Simulink 3D Animation componentsSyntaxvrinstall('action')vrinstall actionx =
vrinstall10-73Action Value Description-install Installs optional components. This action requires you to specifythe component name.-uninstall Uninsta
10 Functions — Alphabetical List10-74vrjoystickCreate joystick objectSyntaxjoy = vrjoystick(id)joy = vrjoystick(id,'forcefeedback')Descripti
vrjoystick10-75Method Descriptionclose close(joy) closes and invalidates the joystickobject. The object cannot be used once it is closed.force force(
10 Functions — Alphabetical List10-76vrlibOpen Simulink block library for Simulink 3D AnimationSyntaxvrlibDescriptionThe Simulink library for the Simu
vrnode10-77vrnodeCreate node or handle to existing nodeSyntaxmynode = vrnodemynode = vrnode([])mynode = vrnode(vrworld_object,'node_name')m
10 Functions — Alphabetical List10-78mynode = vrnode([]) creates an empty array of vrnode handles.mynode = vrnode(vrworld_object,'node_name'
vrnode10-79Method Descriptionsetfield Change field value of vrnode objectsync Enable or disable synchronization of VRML fields with clientSee Alsovrn
1 Getting Started1-28Inverted Pendulum Example (vrpend)The vrpend example illustrates the various ways a dynamic model in the Simulinkinterface can in
10 Functions — Alphabetical List10-80vrnode/deleteRemove vrnode objectSyntaxdelete(vrnode_object)delete(n)Argumentsvrnode_object Name of a vrnode obje
vrnode/fields10-81vrnode/fieldsVRML field summary of node objectSyntaxfields(vrnode_object)x = fields(vrnode_object)Argumentsvrnode_object Name of a
10 Functions — Alphabetical List10-82vrnode/getProperty value of vrnode objectSyntaxget(vrnode_object)x = get(vrnode_object)x = get(vrnode_object, &ap
vrnode/get10-83Property Value DescriptionName String Name of the node.Type String VRML type of the node. The value is a string (forexample, 'Tra
10 Functions — Alphabetical List10-84vrnode/getfieldField value of vrnode objectSyntaxgetfield(vrnode_object)x = getfield(vrnode_object)x = getfield(v
vrnode/getfield10-85See Alsovrnode | vrnode/get | vrnode/set | vrnode/setfield
10 Functions — Alphabetical List10-86vrnode/isvalid1 if vrnode object is valid, 0 if notSyntaxx = isvalid(vrnode_object_vector)Argumentsvrnode_object_
vrnode/set10-87vrnode/setChange property of virtual world nodeSyntaxx = set(vrnode_object, 'property_name','property_value')Argum
10 Functions — Alphabetical List10-88Property Value DescriptionWorld Handle Handle of the parent vrworld object. This is a vrworldobject that represen
vrnode/setfield10-89vrnode/setfieldChange field value of vrnode objectSyntaxx = setfield(vrnode_object,'fieldname','fieldvalue')A
Virtual Reality World and Dynamic System Examples1-29Mutual gravity accelerations of the bodies are computed using Simulink matrix-type datasupport.P
10 Functions — Alphabetical List10-90vrnode/syncEnable or disable synchronization of VRML fields with clientSyntaxsync(vrnode_object, 'field_name
vrnode/sync10-91See Alsovrnode | vrnode/get
10 Functions — Alphabetical List10-92vrori2dirConvert viewpoint orientation to directionSyntaxvrori2dir(r)vrori2dir(r,options)Descriptionvrori2dir(r)
vrpatch2ifs10-93vrpatch2ifsConvert MATLAB patches to VRML IndexedFaceSet nodesSyntaxnode = vrpatch2ifs(patches,world)node = vrpatch2ifs(patches,shape
10 Functions — Alphabetical List10-94ExamplesConvert MATLAB Patches to VRML IndexedFaceSet NodesThis command converts three MATLAB patches to VRML Ind
vrpatch2ifs10-95dv.position = [-1 15 30];dv.orientation = [-0.38 -0.93 0 0.55];setfield(dv,'set_bind',true); %#ok<STFLD,SFLD>Convert
10 Functions — Alphabetical List10-96Virtual world that contains Shape nodes, specified as a vrworld object.parent — Parent grouping nodevrnode object
vrphysmod10-97vrphysmodAdd virtual reality visualization framework to block diagramsSyntaxvrphysmod(vrmlfile, model)vrphysmod(vrmlfile, subsystem)Des
10 Functions — Alphabetical List10-98ExamplesTo update the model four_link using the VRML file four_link.wrl:vrphysmod('four_link.wrl', &apo
vrplay10-99vrplayPlay VRML animation fileSyntaxvrplayvrplay(filename)x=vrplay(filename)Descriptionvrplay opens the 3D Animation Player, which you us
1 Getting Started1-30MATLAB Interface ExamplesThe following table lists the MATLAB interface examples provided with the software.Descriptions of the e
10 Functions — Alphabetical List10-100rewindstep reversestopplaystep forwardfast forwardstartjumplooptime indicatorlastSetting the DefaultViewer prope
vrplay10-101Key FunctionP Play/pause toggleS StopR, Page Up RewindRight arrow key Step forwardLeft arrow key Step reverseUp arrow key FirstDown arrow
10 Functions — Alphabetical List10-102vrrotvecCalculate rotation between two vectorsSyntaxr = vrrotvec(a,b)r = vrrotvec(a,b,options)Descriptionr = vrr
vrrotmat2vec10-103vrrotmat2vecConvert rotation from matrix to axis-angle representationSyntaxr = vrrotmat2vec(m)r = vrrotmat2vec(m,options)Descriptio
10 Functions — Alphabetical List10-104vrrotvec2matConvert rotation from axis-angle to matrix representationSyntaxm = vrrotvec2mat(r)m = vrrotvec2mat(r
vrsetpref10-105vrsetprefChange Simulink 3D Animation preferencesSyntaxvrsetpref('preference_name', 'preference_value')vrsetpref(&
10 Functions — Alphabetical List10-106Preference DescriptionInt32 data type is returned as 'double'.Default is 'double'.DataTypeFl
vrsetpref10-107Preference DescriptionDefaultFigureCaptureFileNameSpecifies default file name for capturing viewerfigures. See get (vrfigure) for deta
10 Functions — Alphabetical List10-108Preference DescriptionDefaultFigureRecord2DFPS Specifies the default frames per second playbackspeed.To have the
vrsetpref10-109Preference DescriptionDefaultViewer Specifies which viewer is used to view a virtualscene.• 'internal'Default Simulink 3D An
Virtual Reality World and Dynamic System Examples1-31of time-based temperature distribution in an L-shaped metal block is used. The data isthen sent
10 Functions — Alphabetical List10-110Preference DescriptionDefaultWorldTimeSource Specifies the default source of the time for newvrworld objects. Va
vrsetpref10-1113D Animation Viewer. Changes to the HttpPort or VrPort preferences take effect onlyafter you restart the MATLAB software.DefaultFigure
10 Functions — Alphabetical List10-112%file Refers to the VRML file nameFor instance, a possible value for the Editor preference is`%matlabroot\bin\wi
vrspacemouse10-113vrspacemouseCreate space mouse objectSyntaxmouse = vrspacemouse(id)Descriptionmouse = vrspacemouse(id) creates a space mouse object
10 Functions — Alphabetical List10-114Property DescriptionUpperPositionLimit Position coordinates for the upper limit of the mouse.LimitPosition Enabl
vrspacemouse10-115Method Descriptionviewpoint p = viewpoint(mouse) reads the space mousecoordinates in VRML viewpoint format. Translationsand rotatio
10 Functions — Alphabetical List10-116vr.utils.stereo3d classStereoscopic vision settings for vr.canvas and vr.figure objectsDescriptionSpecifies thes
vr.utils.stereo3d class10-117stereoVision = vr.utils.stereo3d.ANAGLYPH_RED_GREEN enables red-greenanaglyph stereoscopic vision.stereoVision = vr.util
10 Functions — Alphabetical List10-118Horizontal image translation, specified as either the predefined DEFAULT_HIT or asa floating-point number from 0
vr.utils.stereo3d class10-119Stereoscopic vision mode. Read only.• STEREO3D_OFF — No stereoscopic vision.• STEREO3D_ACTIVE — Active stereoscopic visi
1 Getting Started1-32worlds that are associated with Simulink models, where scene time corresponds directlyto the Simulink time.The scene time can rep
10 Functions — Alphabetical List10-120ExamplesDefine and Apply Stereoscopic Vision SettingsCreate a virtual world.w = vrworld('octavia_scene&apos
vrview10-121vrviewView virtual world using Simulink 3D Animation viewer or Web browserSyntaxvrviewx = vrview('filename')x = vrview('fi
10 Functions — Alphabetical List10-122vrwhoList virtual worlds in memorySyntaxvrwhox = vrwhoDescriptionIf you do not specify an output parameter, vrwh
vrwhos10-123vrwhosList details about virtual worlds in memorySyntaxvrwhosDescriptionvrwhos displays a list of virtual worlds currently in memory, wit
10 Functions — Alphabetical List10-124vrworldCreate new vrworld object associated with virtual worldSyntaxmyworld = vrworld(filename)myworld = vrworld
vrworld10-125myworld = vrworld creates an invalid vrworld handlemyworld = vrworld('') creates an empty vrworld object that is not associate
10 Functions — Alphabetical List10-126Method Descriptionreload Reload virtual world from VRML filesave Write virtual world to VRML fileset Change prop
vrworld/addexternproto10-127vrworld/addexternprotoAdd externproto declaration to virtual worldSyntaxaddexternproto(vrworld_object, protofile, protona
10 Functions — Alphabetical List10-128in the virtual scene associated with vrworld_object. After you save the virtual world,these PROTO declarations n
vrworld/close10-129vrworld/closeClose virtual worldSyntaxclose(vrworld_object)Argumentsvrworld_object A vrworld object representing the virtual world
Virtual Reality World and Dynamic System Examples1-33This example requires the Mapping Toolbox software from MathWorks®.Plane Manipulation Using Spac
10 Functions — Alphabetical List10-130close(myworld)See Alsovrworld | vrworld/delete | vrworld/open
vrworld/delete10-131vrworld/deleteRemove virtual world from memorySyntaxdelete(vrworld_object)Argumentsvrworld_object A vrworld object representing a
10 Functions — Alphabetical List10-132vrworld/editOpen virtual world file in external VRML editorSyntaxedit(vrworld_object)Argumentsvrworld_object A v
vrworld/get10-133vrworld/getProperty value of vrworld objectSyntaxget(vrworld_object)x = get(vrworld_object)x = get(vrworld_object, 'property_na
10 Functions — Alphabetical List10-134Property Value DescriptionClientUpdates 'off' | 'on'Default: 'on'Client cannot or
vrworld/get10-135Property Value DescriptionRecordInterval Vector of two doublesDefault: [0 0]Start and stop times for scheduledanimation recording. C
10 Functions — Alphabetical List10-136The RemoteView property is set to 'off' by default and can be set by the user. If it isset to 'on
vrworld/isvalid10-137vrworld/isvalid1 if vrworld object is valid, 0 if notSyntaxx = isvalid(vrworld_object)Argumentsvrworld_object A vrworld object r
10 Functions — Alphabetical List10-138vrworld/nodesList nodes available in virtual worldSyntaxnodes(vrworld_object, '-full')x = nodes(vrworl
vrworld/open10-139vrworld/openOpen virtual worldSyntaxopen(vrworld_object)Argumentsvrworld_object A vrworld object representing a virtual world.Descr
10 Functions — Alphabetical List10-140myworlds = [myworld1 myworld2];open(myworlds) opens both of these virtual worlds.See Alsovrworld | vrworld/close
vrworld/reload10-141vrworld/reloadReload virtual world from VRML fileSyntaxreload(vrworld_object)Argumentsvrworld_object A vrworld object representin
10 Functions — Alphabetical List10-142vrworld/saveWrite virtual world to VRML fileSyntaxsave(vrworld_object,'vrml_file')save(vrworld_object,
vrworld/set10-143vrworld/setChange property values of vrworld objectSyntaxset(vrworld_object, 'property_name', property_value)Argumentsvrwo
10 Functions — Alphabetical List10-144Property Value DescriptionNodes Vector of vrnode objects Vector of vrnode objects for all namednodes in the virt
vrworld/set10-145Property Value DescriptionTimeSource 'external' | 'freerun'Default: 'external'Source of the time for t
10 Functions — Alphabetical List10-146vrworld/viewView virtual worldSyntaxview(vrworld_object)x = view(vrworld_object)x = view(vrworld_object,'-i
vrworld/view10-147Examplesmyworld = vrworld('vrpend.wrl')open(myworld)view(myworld)See Alsovrview | vrworld
Glossary-1GlossarysimulationThe process of running a dynamic system in nonreal timeto observe its behavior.virtual figure objectA handle to a Simulink
2InstallationThe Simulink 3D Animation product provides the files you need for installation on bothyour host computer and client computer.• “Set the D
vContentsGetting Started1Simulink 3D Animation Product Description . . . . . . . . . . . . 1-2Key Features . . . . . . . . . . . . . . . . . . . . . .
2 Installation2-2Set the Default ViewerIf you install a VRML plug-in in your Web browser, it is possible to view virtual worldswith either the Simulin
Set the Default Viewer2-3 DefaultFigureTextures: 'on' DefaultFigureToolBar: 'on'
2 Installation2-42Reset the Simulink 3D Animation Viewer as your default viewer by typingvrsetpref('DefaultViewer','factory') 3In
Set the Default Viewer2-5The target of the View button is determined by the DefaultViewer property. Ifthe DefaultViewer property is set to 'inte
2 Installation2-6Install V-Realm Editor on Host ComputerIn this section...“V-Realm Editor Installation (Windows)” on page 2-6“V-Realm Builder Help” on
Install V-Realm Editor on Host Computer2-7V-Realm Builder HelpNote: You cannot access the V-Realm Builder documentation from the Web. If you arereadi
2 Installation2-8Set the Default EditorIn this section...“Use Preferences to Set the Default Editor” on page 2-8“Use MATLAB Commands to Set the Defaul
Set the Default Editor2-9You can use the VRML Editor preference to select another editor: the V-Realm Builder,the MATLAB editor, or a third-party VRM
2 Installation2-102The default is the 3D World Editor (*BUILTIN). To change the editor, use thevrsetpref command, specifying the editor that you want.
Set Simulink 3D Animation Preferences2-11Set Simulink 3D Animation PreferencesIn this section...“Ways to Access Simulink 3D Animation Preferences” on
vi ContentsInstall V-Realm Editor on Host Computer . . . . . . . . . . . . . . . 2-6V-Realm Editor Installation (Windows) . . . . . . . . . . . . . .
2 Installation2-12Access the Preferences Dialog BoxTo access the Simulink 3D Animation preferences dialog box:1From the MATLAB Toolstrip, in the Home
Set Simulink 3D Animation Preferences2-133Set the preferences that you want. See the following table for the preferences thatyou can change. Click OK
2 Installation2-14Preference Value DescriptionDefault: 'logical' If set to 'logical', the VRML Bool data type isreturned as a logi
Set Simulink 3D Animation Preferences2-15Preference Value DescriptionVRML Editor Built-in 3D WorldEditor | V-RealmBuilder | MATLABEditor | CustomSpec
2 Installation2-16Property Value DescriptionTriad 'none' | 'top left' | 'topright' | 'bottom left' |'bott
Set Simulink 3D Animation Preferences2-17Figure PreferencesThe Simulink 3D Animation figure has a number of preferences:• “Figure Rendering Preferenc
2 Installation2-18Property Value DescriptionNavigation zones 'off' | 'on'Default: 'on'Specifies whether navigationzones
Set Simulink 3D Animation Preferences2-195Set the preferences as desired. See the following table for the rendering preferencesyou can change. Click
2 Installation2-20Property Value Descriptionyou enter is unsuitable, awarning might trigger. Thesoftware then automaticallyadjusts the property to the
Set Simulink 3D Animation Preferences2-215Set the preferences as desired. See the following table for the rendering preferencesyou can change. Click
viiView Virtual World Remotely . . . . . . . . . . . . . . . . . . . . . . . . 3-16Working with VRML Sensors . . . . . . . . . . . . . . . . . . . . .
2 Installation2-22Figure Frame Capture PreferencesTo access the virtual figure frame capture preferences:1From the MATLAB Toolstrip, in the Home tab,
Set Simulink 3D Animation Preferences2-23Virtual World PreferencesTo access the virtual world preferences:1From the MATLAB Toolstrip, in the Home tab
2 Installation2-244Set the preferences as desired. See the following table for the rendering preferencesyou can change. Click OK to save the settings.
Set Simulink 3D Animation Preferences2-25Property Value DescriptionDefault: 'off' remote viewing, it is set to 'on';otherwise, it
2 Installation2-26Uninstall V-Realm BuilderUse the MathWorks uninstaller. Running this utility removes the Simulink 3DAnimation and Ligos V-Realm Buil
Test the Viewer Installation2-27Test the Viewer InstallationIn this section...“Section Overview” on page 2-27“Simulink Testing” on page 2-27“MATLAB T
2 Installation2-28The Simulink 3D Animation Viewer opens with a 3-D model of the pendulum.
Test the Viewer Installation2-292In the Simulink 3D Animation Viewer, from the Simulation menu, click Run. ATrajectory Graph window opens, and a simu
2 Installation2-303In the Simulink 3D Animation Viewer, point to a position on the blue surface andleft-click.The pendulum set point, represented by t
Test the Viewer Installation2-31You can now use the trajectory graph as a 2-D input device to set the position of thependulum.6Move the mouse pointer
viii ContentsScheduled 2-D AVI Recording with MATLAB . . . . . . . . . . . 4-25Record Animations for Unconnected Virtual Worlds . . . . . 4-28Play Ani
2 Installation2-328Close the Simulink 3D Animation Viewer and close the Simulink window.You can try other examples in “Simulink Interface Examples”, o
Test the Viewer Installation2-332Use the viewer controls to move within the virtual world, or use the example dialogbox to rotate the membrane. Note
3Simulink InterfaceThe Simulink 3D Animation product works with both the MATLAB and the Simulinkproducts. However, the Simulink interface is the prefe
3 Simulink Interface3-2Virtual World Connection to a ModelIn this section...“Add a Simulink 3D Animation Block” on page 3-2“Changing the Virtual World
Virtual World Connection to a Model3-32From the Simulation menu, select Mode > Normal, then click Simulation > Run.Observe the results of the s
3 Simulink Interface3-46In the Description text box, enter a brief description of the model. This descriptionappears on the list of available worlds s
Virtual World Connection to a Model3-5The Plane Transform tree expands. Now you can see what characteristics of theplane can be driven from the Simul
3 Simulink Interface3-6The first input is Plane rotation. The rotation is defined by a four-element vector.The first three numbers define the axis of
Virtual World Connection to a Model3-715Double-click the VR Sink block in the Simulink model. Select the View button. Aviewer window containing the p
ixUsing the 3D World Editor63D World Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2Supported Platforms . . . . .
3 Simulink Interface3-8Changing the Virtual World Associated with a Simulink BlockOn occasion, you might want to associate a different virtual world w
Virtual World Connection to a Model3-9A VRML tree appears on the right side. The Simulink software associates a newvirtual world with the model.5On t
3 Simulink Interface3-10Open a Viewer WindowWhen you simulate a model that contains a VR Sink block, your default viewer opens anddisplays the virtual
Display Virtual World and Start Simulation3-11Display Virtual World and Start SimulationThis example explains how to display a simulated virtual worl
3 Simulink Interface3-122In the Simulink 3D Animation Viewer, from the Simulation menu, click Run.The simulation starts. In the Simulink 3D Animation
View Virtual World on Host Computer3-13View Virtual World on Host ComputerNormally, you view a virtual world by double-clicking the VR Sink in the Si
3 Simulink Interface3-14The following page is loaded and becomes active.The main HTML page for the Simulink 3D Animation product lists the currentlyav
View Virtual World on Host Computer3-15From the main HTML page, you can select one of the listed available worlds or click thereload link to update t
3 Simulink Interface3-16View Virtual World RemotelyThe Simulink 3D Animation software allows you to simulate a process on a hostcomputer while running
View Virtual World Remotely3-172Double-click the VR Sink block. This block is in the right part of the model window.A VRML viewer also opens with a 3
Komentarze do niniejszej Instrukcji