Class CollisionOps
See Also: Class ICollision, Class CollisionPlane, Class CollisionSphere, Class CollisionVNormal, Class CollisionMesh, Class Box3, Class Point3, Class FPInterface
class CollisionOps : public FPInterface
Description:
This class is available in release 4.0 and later only.
This class represents the operation interface to the collision detection system.
The interface ID is defined as COLLISION_FO_INTERFACE. To obtain a pointer to this interface you can use the macro GetCollisionOpsInterface(cd), which will return (CollisionOps *)(cd)->GetFPInterface(COLLISION_FO_INTERFACE).
Methods:
public:
Prototype:
virtual int SuppportedCollisions(ReferenceTarget *r) = 0;
Remarks:
This method returns the collision type supported by the engine.
Parameters:
ReferenceTarget *r
A pointer to the reference target to check the collision type for.
Return Value:
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.
Prototype:
virtual void PreFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
Remarks:
This method will be called once before the checkcollision is called for each frame which allows you to do any required initialization.
Parameters:
ReferenceTarget *r
A pointer to the reference target.
TimeValue t
The time at which to initialize.
TimeValue dt
The delta of time the particle wil travel.
Prototype:
virtual void PostFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
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:
ReferenceTarget *r
A pointer to the reference target.
TimeValue t
The time at which to initialize.
TimeValue dt
The delta of time the particle wil travel.
Prototype:
virtual BOOL CheckCollision (ReferenceTarget *r,TimeValue t, Point3 pos, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
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:
ReferenceTarget *r
A pointer to the reference target.
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.
Return Value:
TRUE if there’s a collision, otherwise FALSE.
Prototype:
virtual BOOL CheckCollision (ReferenceTarget *r,TimeValue t,Point3 pos, float radius, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;;
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:
ReferenceTarget *r
A pointer to the reference target.
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.
Return Value:
TRUE if there’s a collision, otherwise FALSE.
Prototype:
virtual BOOL CheckCollision (ReferenceTarget *r,TimeValue t, Box3 box, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
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:
ReferenceTarget *r
A pointer to the reference target.
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.
Return Value:
TRUE if there’s a collision, otherwise FALSE.
Prototype:
virtual BOOL CheckCollision (ReferenceTarget *r,TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
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:
ReferenceTarget *r
A pointer to the reference target.
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.
Return Value:
TRUE if there’s a collision, otherwise FALSE.