Post

Collision

Collision

Overview

Collision detects camera-to-object contact using current view and NavigationInfo avatarSize. Collision is a Grouping node that reports collision detection for its children.

The Collision node belongs to the Navigation component and requires at least level 2, its default container field is children. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
+ X3DNode
  + X3DChildNode
    + X3DGroupingNode
      + Collision (X3DSensorNode)*

* Derived from multiple interfaces.

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFString [in, out] description “”

Author-provided prose that describes intended purpose of the node.

Hint

  • Many XML tools substitute XML character references for special characters automatically if needed within an attribute value (such as & for & ampersand character, or " for “ quotation-mark character).

SFBool [in, out] enabled TRUE

Enables/disables collision detection for children and all descendants.

Hint

  • Former name “collide” in VRML97 specification.

SFBool [out] isActive

isActive true/false events are sent when triggering the sensor. isActive=true when view-object collision occurs, isActive=false when view-object collision no longer occurs.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFTime [out] collideTime

Time of collision between camera (avatar) and geometry.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [in, out] visible TRUE

Whether or not renderable content within this node is visually displayed.

Hints

  • The visible field has no effect on animation behaviors, event passing or other non-visual characteristics.
  • Content must be visible to be collidable and to be pickable.

SFBool [in, out] bboxDisplay FALSE

Whether to display bounding box for associated geometry, aligned with world coordinates.

Hint

  • The bounding box is displayed regardless of whether contained content is visible.

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.

Hints

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

Bounding box center accompanies bboxSize and provides an optional hint for bounding box position offset from origin of local coordinate system.

Hints

SFNode [ ] proxy NULL [X3DChildNode]

The proxy node is used as a substitute for Collision children during collision detection, simplifying collision-intersection computations.

Hint

  • The proxy node is used strictly for collision detection and is not drawn.

Warnings

  • The proxy node must have containerField='proxy' or it is simply treated like other children nodes.
  • Insert a Shape node before adding geometry or Appearance.

MFNode [in] addChildren

Input field addChildren.

MFNode [in] removeChildren

Input field removeChildren.

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

Grouping nodes contain an ordered list of children nodes.

Hints

  • 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.
  • InputOnly MFNode addChildren field can append new X3DChildNode nodes via a ROUTE connection, duplicate input nodes (i.e. matching DEF, USE values) are ignored.
  • InputOnly MFNode removeChildren field can remove nodes from the children list, unrecognized input nodes (i.e. nonmatching DEF, USE values) are ignored.
  • X3D Architecture 10.2.1 Grouping and children node types

Advice

Hints

  • Collision can contain a single proxy child node for substitute collision-detection geometry. Improve run-time performance by using proxy with simpler contact-calculation geometry.
  • Proxy shapes are not rendered and remain invisible.
  • Apply containerField='proxy' to uniquely identify the proxy child Shape or grouping node.
  • NavigationInfo types ‘“WALK” “FLY”’ support camera-to-object collision detection.
  • Content must be visible to be collidable and to be pickable.
  • Insert a Shape node before adding geometry or Appearance.

Warning

Example

See Also

This post is licensed under CC BY 4.0 by the author.