Class dnx.lr.node.CollisionNode
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.lr.node.CollisionNode

java.lang.Object
   |
   +----dnx.util.DNXObject
           |
           +----dnx.lr.Node
                   |
                   +----dnx.lr.GroupingNode
                           |
                           +----dnx.lr.node.CollisionNode

public class CollisionNode
extends GroupingNode
 Collision {
    eventIn      MFNode       addChildren     
    eventIn      MFNode       removeChildren  
    exposedField MFNode       children        []
    exposedField SFBool       collide         TRUE
    field        SFVec3f      bboxCenter      0 0 0
    field        SFVec3f      bboxSize        -1 -1 -1
    field        SFNode       proxy           NULL
    eventOut     SFTime       collideTime     
 }

By default, all objects in the scene are collidable. Browser shall detect geometric collisions between the user's avatar (see NavigationInfo) and the scene's geometry, and prevent the avatar from `entering' the geometry. The Collision node is grouping node that may turn off collision detection for its descendants, specify alternative objects to use for collision detection, and send events signaling that a collision has occurred between the user's avatar and the Collision group's geometry or alternate. If there are no Collision nodes specified in a scene, browsers shall detect collision with all objects during navigation.

See the "Concepts - Grouping and Children Nodes" section for a description the children, addChildren, and removeChildren fields and eventIns.

The Collision node's collide field enables and disables collision detection. If collide is set to FALSE, the children and all descendants of the Collision node will not be checked for collision, even though they are drawn. This includes any descendant Collision nodes that have collide set to TRUE - (i.e. setting collide to FALSE turns it off for every node below it).

Collision nodes with the collide field set to TRUE detect the nearest collision with their descendant geometry (or proxies). Note that not all geometry is collidable - see each geometry node's sections for details. When the nearest collision is detected, the collided Collision node sends the time of the collision through its collideTime eventOut. This behavior is recursive - if a Collision node contains a child, descendant, or proxy (see below) that is a Collision node, and both Collisions detect that a collision has occurred, then both send a collideTime event out at the same time, and so on.

The bboxCenter and bboxSize fields specify a bounding box that encloses the Collision's children. This is a hint that may be used for optimization purposes. If the specified bounding box is smaller than the actual bounding box of the children at any time, then the results are undefined. A default bboxSize value, (-1 -1 -1), implies that the bounding box is not specified and if needed must be calculated by the browser. See "Concepts - Bounding Boxes" for a description of the bboxCenter and bboxSize fields.

The collision proxy, defined in the proxy field, is a legal child node, (see "Concepts - Grouping and Children Nodes"), that is used as a substitute for the Collision's children during collision detection. The proxy is used strictly for collision detection - it is not drawn.

If the value of the collide field is FALSE, then collision detection is not performed with the children or proxy descendant nodes. If the root node of a scene is a Collision node with the collide field set to FALSE, then collision detection is disabled for the entire scene, regardless of whether descendent Collision nodes have set collide TRUE.

If the value of the collide field is TRUE and the proxy field is non-NULL, then the proxy field defines the scene which collision detection is performed. If the proxy value is NULL, the children of the collision node are collided against.

If proxy is specified, then any descendant children of the Collision node are ignored during collision detection. If children is empty, collide is TRUE and proxy is specified, then collision detection is done against the proxy but nothing is displayed (i.e. invisible collision objects).

The collideTime eventOut generates an event specifying the time when the user's avatar (see NavigationInfo) intersects the collidable children or proxy of the Collision node. An ideal implementation computes the exact time of intersection. Implementations may approximate the ideal by sampling the positions of collidable objects and the user. Refer to the NavigationInfo node for parameters that control the user's size.

Browsers are responsible for defining the navigation behavior when collisions occur. For example, when the user comes sufficiently close to an object to trigger a collision, the browser may have the user bounce off the object, come to a stop, or glide along the surface.


Variable Index

 o bboxCenter
 o bboxSize
 o children
 o collide
 o collideTime
 o proxy

Constructor Index

 o CollisionNode()

Method Index

 o boundingBoxHasChanged(Field)
Meant to be overridden by subclasses.
 o createNodeDefinition(NodeDefinition)
Create the node definition.
 o geometryHit()
 o getChildren()
 o handleEvent(SceneEvent)
Handle an event.
 o initFields()
Initialize field values.
 o mapNormalInstanceChildren(NodeInstance, ChildInstanceMapper, Object)
 o recomputeBoundingBox(BoundingBox3)
Meant to be overridden by subclasses; compute the bounding box and store into the argument.

Variables

 o children
  public MFNode children
 o collide
  public SFBool collide
 o bboxCenter
  public SFVec3f bboxCenter
 o bboxSize
  public SFVec3f bboxSize
 o proxy
  public SFNode proxy
 o collideTime
  public SFTime collideTime

Constructors

 o CollisionNode
  public CollisionNode()

Methods

 o createNodeDefinition
  protected void createNodeDefinition(NodeDefinition def)
Create the node definition.
Overrides:
createNodeDefinition in class Node
 o initFields
  protected void initFields()
Initialize field values.
Overrides:
initFields in class Node
 o getChildren
  public MFNode getChildren()
Overrides:
getChildren in class GroupingNode
 o handleEvent
  protected void handleEvent(SceneEvent ev)
Handle an event.
Overrides:
handleEvent in class Node
 o recomputeBoundingBox
  public void recomputeBoundingBox(BoundingBox3 box)
Meant to be overridden by subclasses; compute the bounding box and store into the argument.
Overrides:
recomputeBoundingBox in class Node
 o boundingBoxHasChanged
  protected boolean boundingBoxHasChanged(Field f)
Meant to be overridden by subclasses.
Overrides:
boundingBoxHasChanged in class Node
 o mapNormalInstanceChildren
  public final NodeInstance mapNormalInstanceChildren(NodeInstance inst,
                                                      ChildInstanceMapper fun,
                                                      Object mapData)
Overrides:
mapNormalInstanceChildren in class Node
 o geometryHit
  public void geometryHit()

All Packages  Class Hierarchy  This Package  Previous  Next  Index