C3DObject::SphereCollided

Top  Previous  Next

Syntax:

 

SphereCollided(VECTOR3 position, float  radius, int  bChildren), int

 

Purpose:

Collision tests an object against a sphere.

 

Parameters:

position - The spheres position, in world space.

radius - The spheres radius.

 

Returned value(s):

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

 

Application:

if mesh1.SphereCollided(pos, 10.0, TRUE) then HandleCollisions()

 

Class Hierarchy

C3DObject

 

Additional Info:

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 target sphere.

 

See Also:

InitCollision, RayCollided, ObjectCollided, GetCollisionPoint,