Class: Switch

X3D: 3.3
Component: Grouping
fully implemented

x3dom.nodeTypes. Switch

The Switch grouping node traverses zero or one of the nodes specified in the children field. All nodes under a Switch continue to receive and send events regardless of the value of whichChoice. For example, if an active TimeSensor is contained within an inactive choice of an Switch, the TimeSensor sends events regardless of the Switch's state.

HTML Encoding and Default Values

<Switch bboxCenter='0,0,0' bboxSize='-1,-1,-1' children='X3DChildNode' metadata='X3DMetadataObject' render='true' whichChoice='-1' ></Switch>




Constructor for Switch

Name Type Argument Default Description
ctx Object <optional>
null context object, containing initial settings like namespace


These are the X3D / X3DOM fields of this node. Values should usually be received / set as strings via DOM functions (i.e., using setAttribute("myFieldName", "myFieldValue") and getAttribute("myFieldName")).
Name Type Default Value Range Inheritance Standard Description
bboxCenter SFVec3f 0,0,0 [-inf, inf] X3DGroupingNode Center of the bounding box
bboxSize SFVec3f -1,-1,-1 [0, inf] or -1 X3DGroupingNode Size of the bounding box
children MFNode X3DChildNode X3DGroupingNode Grouping nodes have a field that contains a list of children nodes. Each grouping node defines a coordinate space for its children. This coordinate space is relative to the coordinate space of the node of which the group node is a child. Such a node is called a parent node. This means that transformations accumulate down the scene graph hierarchy.
metadata SFNode X3DMetadataObject X3DGroupingNode Field to add metadata information
render SFBool true X3DGroupingNode Flag to enable/disable rendering
whichChoice SFInt32 -1 The whichChoice field specifies the index of the child to traverse, with the first child having index 0. If whichChoice is less than zero or greater than the number of nodes in the children field, nothing is chosen.