Titania X3D Editor

Bring Colours to Your Life.

Titania v4.0.1

Bring Colours to Your Life.

X3D Reference

Switch

Switch

Switch is a Grouping node that only renders one (or zero) child at a time. Switch can contain most nodes. (Contained nodes are now called 'children' rather than 'choice', for consistent naming among all GroupingNodeType nodes.) All child choices continue to receive & send events regardless of whichChoice is active.

The Switch node belongs to the Grouping component and its container field is children. It is available since X3D version 3.0 or later.

Hierarchy

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Metadata are not part of the X3D world and not interpreted by the X3D browser, but they can be accessed via the ECMAScript interface.

SFInt32 [in, out] whichChoice -1 [-1,∞)

Index of active child choice, counting from 0.

Warning

Default whichChoice= -1 means no selection (and no rendering), whichChoice=0 means initial child.

SFVec3f [ ] bboxSize -1 -1 -1 [0,∞) or −1 −1 −1

Bounding box size is usually omitted, and can easily be calculated automatically by an X3D player at scene-loading time with minimal computational cost. Bounding box size can also be defined as an optional authoring hint that suggests an optimization or constraint.

Hint

Can be useful for collision computations or inverse-kinematics (IK) engines.

SFVec3f [ ] bboxCenter 0 0 0 (-∞,∞)

Bounding box center: optional hint for position offset from origin of local coordinate system.

MFNode [in] addChildren

Input field addChildren.

MFNode [in] removeChildren

Input field removeChildren.

MFNode [in, out] children [ ] [X3DChildNode]

Grouping nodes contain a list of children nodes.

Hint

Each grouping node defines a coordinate space for its children, relative to the coordinate space of its parent node. Thus transformations accumulate down the scene graph hierarchy.

Description

Hints

  • Insert a Shape node before adding geometry or Appearance.
  • Authors can temporarily hide test geometry under an unselected child of a Switch. This is a good alternative to "commenting out" nodes.

Warnings

  • Do not include Viewpoint or OrthoViewpoint as a child of LOD or Switch, instead use ViewpointGroup as parent to constrain location proximity where the viewpoint is available to user.
  • Results are undefined if a bindable node (Viewpoint, OrthoViewpoint, NavigationInfo, Fog, Background, TextureBackground) is a contained child of LOD or Switch.

Browser Compatibility

Titania X_ITE
yes yes

External Links