C3DObject::InitCollision

Top  Previous  Next

Syntax:

 

InitCollision(int  bChildren)

 

Purpose:

Initializes collision detection for a mesh.

 

Parameters:

bChilden - TRUE to also initialize collision detection for all attached children.

 

Returned value(s):

None.

 

Application:

sphere.InitCollision(FALSE)

 

Class Hierarchy

C3DObject

 

Additional Info:

Collisions between objects are performed using search trees that must be initialized before any collisions can be tested. Initializing collisions on large meshes can take time and should be done outside of the main rendering loop.  Scale is ignored when generating the collision trees.

 

The built in collision commands will not work with skinned X format meshes as the location and orientation of the internal mesh frames are constantly changing.  You can use a sphere to represent the skinned X mesh and use SphereCollided for basic collision testing as an alternative.

 

If bChildren is TRUE then all child objects attached to this mesh will be prepared for collision testing as well. This is needed for 3DS files that are separated when loaded.

 

See Also:

RayCollided, ObjectCollided