C3DObject::RayCollided

Top  Previous  Next

Syntax:

 

RayCollided(VECTOR3 origin, VECTOR3 direction, int  bChildren), int

 

Purpose:

Collision tests an object against a ray.

 

Parameters:

origin - The origin of the ray.

direction - The direction of the ray.

 

Returned value(s):

TRUE if any part of this object, or its children, intersect the ray.

 

Application:

if mesh1.RayCollided(origin, dir, TRUE) then HandleCollisions()

 

Class Hierarchy

C3DObject

 

Additional Info:

The rays position and direction are specified in world space.

 

For collision testing to work the InitCollision method must have been called on all objects involved in the test. This method is only valid for objects that contain validly loaded or created geometry, such as C3DMesh.

 

The base class method does nothing, unless bChildren is specified in which case all child objects that contain a mesh will be collision tested against the ray.

 

See Also:

SphereCollided, GetCollisionPoint, InitCollision, ObjectCollided