Creating a Switch

on this page: creating a switch | adding objects | tip

Find it: Click the Switch Editor button on the Action palette:

A switch is a group that displays only one of its children at a time. Typically, a switch is used with a script that controls which child is displayed. A switch can be used to create simple animations or to display different versions of an object under different conditions. See Chapter 7, "Scripting," in The VRML 2.0 Handbook by Jed Hartman and Josie Wernecke for an example of a script that controls a switch.

Creating a Switch

To create a switch:

  1. In the main window, select the objects that will be the children of the switch.

  2. Click the Create Switch Grouping Over All Selections button.

  3. Choose the initial child to display: click either the box labeled None or the box with the child number. Children are numbered in order, starting with 0. The order of the children within the switch is the order in which they were selected. To change the selected child, click the up or down arrow, or type a number in the box.

Adding Objects to an Existing Switch

To add objects to an existing switch:

  1. In the main window, select the objects to add.

  2. Shift-select the switch group last (so that it's the master selection).

  3. Choose Edit > Add to Group.

Tip: If you want all the objects to be in the same location, use Selection > Center Snap Target to move the snapping target to the center of the current master selection. Another useful command in the Layout menu is Move Selection Center to Snap Target, which moves the master selection so that its center is at the snap target. Secondary selections move with the master.

Jump to: Script Editor Quick Reference