Switch Node

If you're not familiar to grouping nodes in VRML see the section Creating Hierarchical Node Structures for general information on grouping. 

The Switch node is a grouping node with a difference. At most one of the children nodes are drawn. The whichChoice field specifies the index of which child is to be drawn. If whichChoice is -1 then none of the children are drawn. 

Why do you want a grouping node which draws at most one of its children? In fact it is a very useful node as you shall see.

 One possible use for this node is to have different versions of a given shape inside the Switch node. Setting whichChoice provides a quick way to change between these objects. Because this field is an exposed field it can receive events which can change the child to be drawn. 

Another good use of this node is to have node definitions without drawing them, whichChoice set to -1. Using this approach the node definitions would be together in the file simplifying your life when you try to find a node's definition. 

Note that the whichChoice determines only which child is drawn, however non-graphic nodes still take effect when present in a Switch node. For instance a TimeSensor node will generate events regardless of the value of whichChoice. In fact all nodes will generate and are able to receive events regardless of the whichChoice value. 

Syntax: 
Switch { 
whichChoice -1 
choice [ ]