Public Member Functions

ICollision Class Reference

Search for all occurrences

Detailed Description

See also:
Class CollisionOps, Class CollisionPlane, Class CollisionSphere, Class CollisionVNormal, Class CollisionMesh, Class ReferenceTarget, Class Box3, Class Point3

Description:
This class is available in release 4.0 and later only.

This class represents the virtual class to support collision objects. All collision detection classes should derive from this class. The purpose of this class is to improve the particle collision system for older particle systems and to let other systems such as Flex and MAXScript benefit from a more open architecture and to provide an interface to determine if a particle hit a surface. Additionally three basic collision detection classes are provided, a planar, a spherical, and a mesh deflection class.

#include <icollision.h>

Inheritance diagram for ICollision:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual int  SuppportedCollisions ()=0
virtual void  PreFrame (TimeValue t, TimeValue dt)=0
virtual void  PostFrame (TimeValue t, TimeValue dt)=0
virtual BOOL  CheckCollision (TimeValue t, Point3 pos, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)=0
virtual BOOL  CheckCollision (TimeValue t, Point3 pos, float radius, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)=0
virtual BOOL  CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)=0
virtual BOOL  CheckCollision (TimeValue t, Point3 edgeA, Point3 edgeB, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)=0

Member Function Documentation

virtual int SuppportedCollisions ( ) [pure virtual]
Remarks:
This method returns the collision type supported by the engine.
Returns:
One of the following;

POINT_COLLISION for point collision, currently supported.

SPHERE_COLLISION for spherical collision, currently not supported.

BOX_COLLISION for box collision, currently not supported.

EDGE_COLLISION for edge collision, currently not supported.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual void PreFrame ( TimeValue  t,
TimeValue  dt 
) [pure virtual]
Remarks:
This method will be called once before the checkcollision is called for each frame which allows you to do any required initialization.
Parameters:
TimeValue t

The time at which to initialize.

TimeValue dt

The delta of time the particle wil travel.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual void PostFrame ( TimeValue  t,
TimeValue  dt 
) [pure virtual]
Remarks:
This method will be called at the end of each frame solve to allow you to destroy and deallocate any data you no longer need.
Parameters:
TimeValue t

The time at which to initialize.

TimeValue dt

The delta of time the particle wil travel.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual BOOL CheckCollision ( TimeValue  t,
Point3  pos,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [pure virtual]
Remarks:
This method will be called to execute a point to surface collision and compute the time at which the particle hit the surface.
Parameters:
TimeValue t

The end time of the particle.

Point3 pos

The position of the particle in world space.

Point3 vel

The velocity of the particle in world space.

float dt

The delta of time that the particle travels (t-dt being the start of time of the particle)

float &at

The point in time that the collision occurs with respect to the dt.

Point3 &hitPoint

The point of collision.

Point3 &norm

The bounce vector component of the final velocity.

Point3 &friction

The friction vector component of the final velocity.

Point3 inheritedVel

The approximated amount of velocity inherited from the motion of the deflector.
Returns:
TRUE if there's a collision, otherwise FALSE.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual BOOL CheckCollision ( TimeValue  t,
Point3  pos,
float  radius,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [pure virtual]
Remarks:
This method will be called to execute a sphere to surface collision and compute the time at which the particle hit the surface.
Parameters:
TimeValue t

The end time of the particle.

Point3 pos

The position of the particle in world space.

float radius

The radius of the sphere.

Point3 vel

The velocity of the particle in world space.

float dt

The delta of time that the particle travels (t-dt being the start of time of the particle)

float &at

The point in time that the collision occurs with respect to the dt.

Point3 &hitPoint

The point of collision.

Point3 &norm

The bounce vector component of the final velocity.

Point3 &friction

The friction vector component of the final velocity.

Point3 inheritedVel

The approximated amount of velocity inherited from the motion of the deflector.
Returns:
TRUE if there's a collision, otherwise FALSE.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual BOOL CheckCollision ( TimeValue  t,
Box3  box,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [pure virtual]
Remarks:
This method will be called to execute a box to surface collision and compute the time at which the particle hit the surface.
Parameters:
TimeValue t

The end time of the particle.

Box3 box

The box itself.

Point3 vel

The velocity of the particle in world space.

float dt

The delta of time that the particle travels (t-dt being the start of time of the particle)

float &at

The point in time that the collision occurs with respect to the dt.

Point3 &hitPoint

The point of collision.

Point3 &norm

The bounce vector component of the final velocity.

Point3 &friction

The friction vector component of the final velocity.

Point3 inheritedVel

The approximated amount of velocity inherited from the motion of the deflector.
Returns:
TRUE if there's a collision, otherwise FALSE.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.

virtual BOOL CheckCollision ( TimeValue  t,
Point3  edgeA,
Point3  edgeB,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [pure virtual]
Remarks:
This method will be called to execute an edge to surface collision and compute the time at which the particle hit the surface.
Parameters:
TimeValue t

The end time of the particle.

Point3 edgeA

The first edge.

Point3 edgeB

The second edge.

Point3 vel

The velocity of the particle in world space.

float dt

The delta of time that the particle travels (t-dt being the start of time of the particle)

float &at

The point in time that the collision occurs with respect to the dt.

Point3 &hitPoint

The point of collision.

Point3 &norm

The bounce vector component of the final velocity.

Point3 &friction

The friction vector component of the final velocity.

Point3 inheritedVel

The approximated amount of velocity inherited from the motion of the deflector.
Returns:
TRUE if there's a collision, otherwise FALSE.

Implemented in CollisionPlane, CollisionSphere, and CollisionMesh.


ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision
ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision ICollision