Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Interact with Virtual Reality Worlds

Create and interact with MATLAB® virtual world objects, input virtual world data to Simulink® models

You can use MATLAB functions and classes to interact with virtual reality worlds. Create a virtual world object (vrobject) and node objects (vrnode) to represent a virtual world that you create with Simulink 3D Animation™. Change and control the degrees of freedom for the virtual world from within the MATLAB environment by setting values for the available virtual world nodes and their fields using vrnode object methods.

Virtual reality scenes can contain sensors, which are nodes that generate events and output values depending on time, navigation, and actions and distance changes in the scene. These nodes add interactivity to the virtual world. You can use Simulink 3D Animation functions to read sensor field values into simulation models and control simulation based on the user interaction with the virtual scene. You can write an S-function or a MATLAB Function block that reads the sensor output.

Functions

expand all

vrworldCreate new vrworld object associated with virtual world
vrdrawnowUpdate virtual world
vrnodeCreate node or handle to existing node
vr.canvasCreate virtual reality canvas
vrclearRemove all closed virtual worlds from memory
vrwhoList virtual worlds in memory
vrwhosList details about virtual worlds in memory
vrfigureCreate virtual reality figure
vrfigure.captureCapture virtual reality figure image
vrfigure.closeClose virtual reality figure
vrfigure.getReturn property value of vrfigure object
vrfigure.isvalidCheck validity of vrfigure object handles
vrfigure.setSet property values of vrfigure object
vrgcfHandle for active virtual reality figure
vrgcbfCurrent callback vrfigure object
vrcloseClose virtual reality figure windows
vr.utils.stereo3dStereoscopic vision settings for vr.canvas and vr.figure objects
vrdir2oriConvert viewpoint direction to orientation
vrori2dirConvert viewpoint orientation to direction
vrrotvecCalculate rotation between two vectors
vrrotmat2vecConvert rotation from matrix to axis-angle representation
vrrotvec2matConvert rotation from axis-angle to matrix representation
vrifs2patchConvert virtual world IndexedFaceSet nodes to MATLAB patches
vrpatch2ifsConvert MATLAB patches to IndexedFaceSet nodes
vrjoystickCreate joystick object
vrspacemouseCreate space mouse object

Blocks

VR SourceRead data from virtual world to Simulink model

MATLAB Interaction

Virtual Reality World and Dynamic System Examples

Use virtual worlds that interface to Simulink block diagrams and to MATLAB objects and functions.

Create vrworld Object for a Virtual World

Connect MATLAB to a virtual world and interact with that virtual world through the MATLAB command-line interface by creating vrworld and vrnode objects.

Open a Virtual World with MATLAB

Open a virtual world to view the virtual world in a virtual world viewer, scan its structure, and change virtual world properties from the MATLAB Command Window.

Interact with a Virtual World with MATLAB

Interact with virtual world by using vrnode object methods to set vrworld object property values for all the available virtual world nodes and their fields.

Close and Delete a vrworld Object

Close virtual worlds and remove them from memory.

Virtual World Data Types

Explore the data types used by nodes for defining objects and the types of data that can appear in the node fields and events.

VRML Sensor Input to Models

Use Sensors

Move or modify virtual world objects during simulation based on user input from the virtual world or events in the virtual world.

Modify Remote Virtual World Via Sensor Events

Interactive mode allows clients to modify a remote virtual world via events from sensor nodes defined in the virtual world.

Detect Object Collisions

Use collision detection to avoid having two objects collide, or to trigger a change in virtual world object behavior or display.

Was this topic helpful?