Main Content

Open a Virtual World withMATLAB

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.

After you create avrworldobject, you can open the virtual world by using thevrworldobject associated with that virtual world. This procedure uses thevrworldobjectmyworldassociated with the virtual worldvrmount.x3das an example:

  1. In the MATLAB Command Window, type

    open(myworld);

    The MATLAB Command Window opens the virtual worldvrmount.x3d.

  2. Type

    set(myworld, 'Description', 'My first virtual world');

    TheDescriptionproperty is changed toMy first virtual world. This description displays in all万博1manbetx®3D Animation™object listings, in the title bar of theSimulink 3D AnimationViewer, and in the list of virtual worlds on theSimulink 3D AnimationHTML page.

  3. Display the virtual worldvrmount.x3d. Type

    view(myworld)

    The viewer that is set as the default viewer displays the virtual scene. The default viewer is typically theSimulink 3D AnimationViewer unless you have a different viewer set.

Alternatively, you can display the virtual world in an HTML5-enabled web browser.

  1. Repeat steps 1 and 2 of the preceding procedure.

  2. Open a web browser. In the地址box, type

    http://localhost:8123

    The browser displays theSimulink 3D AnimationHTML page with a link toMy first virtual world. The number8123is the defaultSimulink 3D Animationport number. If you set a different port number on your system, enter that number in place of8123and restart MATLAB. For more information on theSimulink 3D AnimationHTML page, seeView Virtual World on Host Computer.

  3. If the web browser has the VRML or X3D plug-in installed, in the browser window, clickMy first virtual world.

  4. Your default HTML5-enabled web browser displays the virtual worldvrmount.x3d.

    Note

    If your web browser is not HTML5-enabled, clicking a virtual world link such asMy first virtual worldresults in a broken link message. The browser cannot display the virtual world.

For more information on changing your default viewer, seeSet the Default Viewer.

See Also

Functions

Related Topics