Grouping Nodes

A set of nodes can be defined as a group in VRML. The following grouping nodes are avalable in VRML:

  • Anchor : define a complex shape, built using a set of shapes, as a hyperlink to another VRML world, to a HTML page, or to any other data that your browser can read.
  • Billboard : specifying a set of nodes which are always turned to you regardeless of your position.
  • Collision : defining a set of nodes which the browser should be warned when collision occurs.
  • Group : defining a new node type composed by a set of nodes so that you can reuse it later without repeating the entire set of nodes.
  • Switch : defining a set of nodes in which at most one of the nodes is drawn.
  • Transform : defining a new coordinate system so that objects can be placed in locations other than the origin.
  • Grouping also can be used for scoping, i.e. some node types, when placed n a group, only affect the other nodes within the same group. For instance, Directional Lights only affect nodes within the same group (at least according to the official VRML 2.0 specification). Sensor nodes are also constrained to the group their defined in. )

    You can place groups inside groups, creating a hierarchical structure of nodes. A group node can have any number of child nodes inside the children field.

    All grouping nodes accept the following events:

    addChildren: which add a new node to the group
    removeChildren: which removes a given node from the group
    To generate one of these events you have to use Scripts.