Documentation

Edit a Virtual World

For information about opening a file in the editor, seeOpen the 3D World Editor.

For a step-by-step tutorial, seeBuild and Connect a Virtual World.

Add Objects

Add virtual world objects (for example, the wing of an airplane) by adding nodes in thetree structurepane. The hierarchy of nodes controls the scope to which node properties apply.

Note

Nodes must have unique names to work in the金宝app®3D Animation™product.

Approaches for Adding Objects

Use one of these approaches to add a node.

Approach Procedure
Use theNodesmenu
  1. In thetree structurepane, select the parent node for the object that you want to add.

  2. SelectNodes>Add.

  3. t添加节点hat you want, select appropriate submenus.

Use a context menu for a node
  1. In thetree structurepane, right-click the parent node for the object that you want to add.

  2. t添加节点hat you want, select theAdd Nodemenu, and then select appropriate submenus.

Insert an object from a library

ForMaterial,Texture, andchildrennodes, select theInsert Frommenu option (from either theNodesmenu or from the context menu for a node).

For information about library objects, see3D World Editor Library.

Add an inlined virtual world 3D file

For aROOTorchildrennode, from theNodesmenu or the context menu for the node, select theInline Virtual Reality 3D Filemenu item.

You can inline VRML files (.wrl) files, but not X3D files (.x3dor.x3dv).

The node that you add gets added to different locations in the hierarchy, depending on the node that you select to begin adding a node.

Selected Node Location of Added Node
ROOT At the bottom of the hierarchy
Node at the next level down from the ROOT node (for example, aTransformnode). Above the selected node
Achildrennode Under thechildrennode (as a child node of the selected node)

Copy and Paste a Node

You can copy a node below a top-levelTransformnode and paste that copied node to be a child of another node, including theROOTnode.

You can paste the copied node as either an explicit text copy (Paste) or as a referenced copy (Paste As Reference).

  • An explicit text copy allows you to edit properties of that node, independently from the original node that you copied.

  • A referenced copy node appears with the termUSE. Referenced copies streamline thetree structurepane display. Edits that you make to the original (referenced) node are applied to the copied node, ensuring that the two nodes remain exact copies of each other.

To copy and paste a node:

  1. In thetree structurepane, select the node that you want to copy.

  2. Copy the node, usingoneof these techniques:

    • SelectEdit>Copy.

    • Right-click the node and selectCopy.

  3. Under the appropriate node, paste the copied node.

    • Paste the node usingoneof the following techniques:

      • Select theEdit>Pasteor thePaste As Referencemenu item.

      • Right-click the parent node and selectPaste Node, and then selectPasteorPaste As Reference.

Copy and Paste Between Virtual Worlds

In the same editing session, you can copy nodes from a virtual world in one virtual world 3D file to another virtual world in a different file. After you copy the nodes from one virtual world, selectFile>Opento open the second file where you want to paste the nodes.

Edit Object Properties

To define the characteristics of an object, in thetree structurepane, select the appropriate property. At the bottom of the 3D World Editor, use theobject properties editpane to change property values. Then clickApply.

Thetree structurepane shows the current property values, which reflect your edits.

When you enter a numeric field value in the 3D World Editor, you can use MATLAB®expressions and MATLAB variables. For example, to convert an angle from degrees to radians, enter a MATLAB expression such as25*pi/180.

Set Viewpoint Values Using Camera Position

You can use the current camera position to specify interactively a viewpoint in the 3D World Editor.

  1. Navigate to the position in the scene where you want the viewpoint.

  2. In thetree structure窗格中,右键单击Viewpointnode.

  3. SelectCopy values from current camera.

指定一个URL

For objects that have aURLfield, to specify a URL, select the node and use one of these approaches.

  • In the property edit box for the URL, enter the URL.

  • Select the 0 on the left side of the property edit box and click theSelect File URLbutton. Navigate to the file.

Document a Virtual World Using Comments

To document a virtual world, in theobject property editpane, use theCommentstab for nodes and properties. Comments can help others understand the design of a virtual world.

Comments do not appear in the virtual world. They appear in the virtual world 3D file, next to the given node or property, on lines that begin with#.

Display Event Fields

You can displayeventInandeventOut在3 d世界树编辑器窗格。要么click theShow Eventsbuttonor selectTree>Show Events.

You can perform anISmapping for events in aPROTOdeclaration.

Expand and Collapse Nodes

To expand a node in thetree structurepane, click the plus (+) sign to the left of the node. To collapse a node, click the minus (–) sign to the left of the node.

To expand or collapse all nodes in one step, selectTree>Expand AllorTree>Collapse All.

To expand subtrees within a node:

  1. In the tree structure pane, right-click a node.

  2. From the context menu, selectExpand Subtree.

Alternative approaches for expanding the subtree for a node are:

  • SelectTree>Expand Subtree.

  • Click thebutton.

Hide Default Values

To simplify the tree view, you can hide default values. SelectTree>Hide Default Values. To display default values, clear theHide Default Valuesoption.

Highlight Nodes and Virtual World Objects

To select and highlight virtual world objects using the mouse pointer in the 3D World Editor view pane, use the select mode. Use that mode to highlight a node that defines a virtual world object or to highlight a virtual world object that a node defines. In the 3D World Editor display pane, the selected virtual world object is highlighted with an orange outline. For example:

  1. Open thevrtkoffvirtual world and selectFile>Open in editor.

  2. In the 3D World Editor toolbar, click thebutton.

    Tip

    Alternatively, you can select theView Pane>Selectmenu item.

    When the cursor hovers over a selectable object in the view pane, the cursor shape changes to a hand symbol.

  3. In the virtual world display pane, click the tail of the plane.

    The correspondingShapenode in the tree structure pane is highlighted.

  4. In the tree structure pane, click in theTower (Transform)node, select the bottomShapenode. The floors of the tower are highlighted.

    Tip

    If you select a node in the tree structure pane but do not see anything highlighted in the virtual world display pane, adjust the viewing angle to make the highlighted object visible.

  5. To return to navigation mode, in the 3D World Editor toolbar, click thebutton.

    Tip

    Alternatively, you can select theView Pane>Navigatemenu item.

You can useShift-click to select multiple objects in the tree structure pane or view pane.

If you do not want objects to be highlighted when you pick them, in the display pane right-click and clear theRendering>Highlight Selected Objectsoption. Alternatively, you can use theF4key.

Note

Compound virtual world objects, such as objects defined usingInlineandPROTOnodes, are selected and highlighted as a whole. You cannot select individual components of these objects.

Selection and Highlighting Preferences

By default, the cursor in view pane navigates in the virtual world. To have the mouse cursor in the view pane behave in select mode by default, set theSimulink 3D Animation3D World Editor preferenceView pane mouse behaviorpreference toselect. As an alternative, use theDefaultEditorMouseBehaviorparameter with thevrsetprefcommand.

By default, virtual world objects are highlighted when you select them using select mode. To have the default behavior for selected virtual world objects be to not highlight the objects, set theSimulink 3D Animation3D World Editor preferenceHighlight selected objectspreference tooff. As an alternative, use theDefaultEditorHighlightingparameter with thevrsetprefcommand.

Wrap Nodes as Children of Another Node

To wrap contiguous nodes as children of another node:

  1. Select the nodes. You can use theShiftkey to select contiguous nodes, and theCTRLkey to select discontiguous nodes.

  2. Right-click the selected nodes and from the context menu, selectWrap By.

    As an alternative, on the 3D World Editor menu bar, selectNodes>Wrap By.

  3. From the list of nodes, select the node in which you want to wrap the selected nodes.

Remove Nodes

To delete one or more nodes, select the nodes and use one of these methods:

  • On the toolbar, click the red X button.

  • Click the删除button.

  • SelectEdit>删除.

  • Right-click the node and select删除.

From theEditmenu, you can also delete a specific child node or all the children nodes of a selected parent node, without deleting the parent node.

To cut a node and save it to the clipboard, select the node and use one of these techniques:

  • On the toolbar, click the scissors button.

  • SelectEdit>Cut.

  • Right-click the node and selectCut.

Save and Export Virtual World 3D Files

You can save your virtual world files as virtual world using theFile>SaveorFile>Save Asmenu items.

If you use theSaveoption, the 3D World Editor renames the previous version of the file by appending.bakafter the.wrl,.x3dv, or.x3dextension.

If you use theSave Asoption, the 3D World Editor saves the file using the new name that you specify. The file is saved in a form that the Simulink 3D Animation Viewer and 3D World Editor support (for example, the saved file preserves links to the library texture files).

Use theFile>Exportmenu item to export a virtual world 3D file for use:

  • With other VRML or X3D tools

  • On different computers

  • In previous versions of the Simulink 3D Animation (previously the Virtual Reality Toolbox) product (for VRML files)

Note

You cannot save an X3D file (.x3dor.x3dv)文件a VRML (.wrl) file.

For exported files, the 3D World Editor copies referenced inlined virtual world 3D files and texture files to the_filesfolder. It modifies the corresponding URLs for those files, so that they point to the_filesfolder.

Edit VRML and X3D Scripts

To add a VRML or X3DScriptnode:

  1. In theTree structurepane, select theROOTnode.

  2. Select the appropriate type of script, using theNode>Add>Common>Scriptmenu.

To addScriptinterface elements:

  1. Right-click aScriptnode.

  2. Select the appropriateAdd Interface Itemmenu option.

The following is an example of aScriptnode in theTree structurepane.

For aurlnode, click the node and either specify the path to a JavaScript®file or enter the URL code in theObject property editpane.

See Also

Functions

Related Topics