Virtual Reality Toolbox |
 |
Creating a Sphere in a Virtual World
You need to create a virtual world before you can connect it to a Simulink model and visualize signals.
After you add a VR Sink block to your Simulink model, you can create a virtual world using V-Realm Builder. This procedure uses the model vrtut3.mdl
as an example and assumes that you have opened the model and that you have added a VR Sink block. See Adding a Virtual Reality Toolbox Block.
- From the task bar, click Start, and then click Run.
- In the Run dialog box, enter
- The V-Realm Builder application window opens.
- From the File menu, click New or click the blank page icon
.
- In the left pane, V-Realm Builder displays an empty VRML tree, and in the right pane it displays an empty virtual world.
- On the toolbar, click the sphere icon
.
- In the left pane you can see the VRML syntax tree for a sphere. This tree includes the following nodes: Transform, Shape, Appearance, Material, and Sphere. A yellow icon indicates the field of a node.
The top-level node is the Transform node. This grouping node allows you to change the position and scale of objects (children) that are part of this node. Its subtree consists of one object, which is described in the Shape node. The Shape node contains the appearance and geometry fields.
- Expand the Sphere node.
- The radius field appears. The yellow icon indicates the type of value. In this case, f indicates a value with the type
SFFloat
. SFFloat
is a 32-bit floating-point value.
- Double-click the radius field.
- The Edit SFFloat dialog box opens.
- In the text box, enter
0.9
, and then click OK. In the right pane, the sphere appears smaller.

- Under the Shape node, expand the appearance field. Under the appearance field, expand the Appearance node. Under the Appearance node, expand the material field. Under the material field, expand the Material node.
- Under the Material node, double-click the diffuseColor field.
- The Edit Color dialog box opens.
- Set the color to blue or any other color you would like, and then click OK.

- If you want to check or modify the position of the sphere, double-click the translation field under the Transform node. You do not need to change the default values from
[0 0 0]
.
- In this exercise, you want to deform the sphere. You can apply deformation by changing the scale field of the sphere's Transform node. The Virtual Reality Toolbox requires you to assign a name to this node so that it can access it. In VRML syntax, the named nodes are indicated by the "DEF Name Node" statement. V-Realm Builder lists node names next to their icons in the tree viewer.
- Click the Transform node, and then click the node a second time.
- The text appears in edit mode.
- Enter a name for the node. For example, enter the letter S
, and then click anywhere to exit the text mode.
Your next task is to create two boxes in the virtual world. See Creating a Box in a Virtual World.
| Adding a Virtual Reality Toolbox Block | | Creating a Box in a Virtual World |  |