<<VRML 2.0 - An Introductory view by examples

Switch

[switch]                                                 [run]


It is a grouping node that permits the specification of a choice among different children nodes.

{
exposedField MFNode choice [ ] # list of children (n)
exposedField SFInt32 whichChoice # index ( 0 -> n-1 ) of the children to be traversed
}

Usage :


Switch {
  whichChoice 4   #-1 no choice, otherwise 0-n for n+1 choices
  choice [
   ..........(one or more grouping/children nodes)
          ]
        }
# obs : the first node is choice 0, etc