Public Member Functions | Public Attributes | Protected Member Functions

CollisionPlane Class Reference

Search for all occurrences

Detailed Description

See also:
Class ICollision, Class CollisionOps, Class CollisionSphere, Class CollisionVNormal, Class CollisionMesh, Class Box3, Class Point3, Class IParamBlock2, Class INode, Class Control

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

This class represents the planar collision object with the ClassID defined as PLANAR_COLLISION_ID. This class allows you to define a plane in space and determine if a particle hit it.
Data Members:
private:

INode *node;

The associated node.

IParamBlock2 *pblock;

The parameter block data. You can use the following enum parameter ID's:

collisionplane_width

collisionplane_height

collisionplane_quality

collisionplane_node

Interval validity;

The validity interval.

Matrix3 tm;

The plane's TM.

Matrix3 invtm;

The inverse TM.

Matrix3 prevInvTm;

The cached previous inverse TM.

int initialTime;

The initial time.

Tab<Matrix3> invTmList;

The table of inverse TM's.

float width, height;

The width and height of the plane.

int quality;

The collision quality value.

#include <icollision.h>

Inheritance diagram for CollisionPlane:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  CollisionPlane ()
  ~CollisionPlane ()
int  SuppportedCollisions ()
void  PreFrame (TimeValue t, TimeValue dt)
void  PostFrame (TimeValue t, TimeValue dt)
BOOL  CheckCollision (TimeValue t, Point3 pos, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
BOOL  CheckCollision (TimeValue t, Point3 pos, float radius, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
BOOL  CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
BOOL  CheckCollision (TimeValue t, Point3 edgeA, Point3 edgeB, Point3 vel, float dt, float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
void  SetWidth (TimeValue t, float w)
void  SetHeight (TimeValue t, float h)
void  SetQuality (TimeValue t, int q)
void  SetNode (TimeValue t, INode *n)
void  SetWidth (Control *c)
void  SetHeight (Control *c)
void  SetQuality (Control *c)
void  DeleteThis ()
Class_ID  ClassID ()
SClass_ID  SuperClassID ()
int  NumRefs ()
RefTargetHandle  GetReference (int i)
RefTargetHandle  Clone (RemapDir &remap)
RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)

Public Attributes

IParamBlock2 pblock
Interval  validity
Matrix3  tm
Matrix3  invtm
Matrix3  prevInvTm
int  initialTime
Tab< Matrix3 invTmList
float  width
float  height
int  quality

Protected Member Functions

virtual void  SetReference (int i, RefTargetHandle rtarg)

Constructor & Destructor Documentation

Remarks:
Constructor.
Remarks:
Destructor.

Member Function Documentation

int SuppportedCollisions ( ) [inline, virtual]
Remarks:
This method determines the type of collisions that are supported.
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.
Default Implementation:
{ return POINT_COLLISION; }

Implements ICollision.

        { 
        return POINT_COLLISION; 
        } 
void PreFrame ( TimeValue  t,
TimeValue  dt 
) [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.

Implements ICollision.

void PostFrame ( TimeValue  t,
TimeValue  dt 
) [inline, 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.
Default Implementation:
{}

Implements ICollision.

{}
BOOL CheckCollision ( TimeValue  t,
Point3  pos,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [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.

Implements ICollision.

BOOL CheckCollision ( TimeValue  t,
Point3  pos,
float  radius,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [inline, 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.

Implements ICollision.

        {
        return FALSE;
        }
BOOL CheckCollision ( TimeValue  t,
Box3  box,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [inline, 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.

Implements ICollision.

        {
        return FALSE;
        }
BOOL CheckCollision ( TimeValue  t,
Point3  edgeA,
Point3  edgeB,
Point3  vel,
float  dt,
float &  at,
Point3 hitPoint,
Point3 norm,
Point3 friction,
Point3 inheritedVel 
) [inline, 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.

Implements ICollision.

        {
        return FALSE;
        }
void SetWidth ( TimeValue  t,
float  w 
) [inline]
Remarks:
Sets the width of the plane.
Parameters:
TimeValue t

The time at which to set the width.

float w

The width.
Default Implementation:
{ pblock->SetValue(collisionplane_width,t,w); }
{ if (!pblock->GetControllerByID(collisionplane_width)) pblock->SetValue(collisionplane_width,t,w); }
void SetHeight ( TimeValue  t,
float  h 
) [inline]
Remarks:
Sets the height of the plane.
Parameters:
TimeValue t

The time at which to set the height.

float h

The height.
Default Implementation:
{ pblock->SetValue(collisionplane_height,t,h); }
{ if (!pblock->GetControllerByID(collisionplane_height)) pblock->SetValue(collisionplane_height,t,h); }
void SetQuality ( TimeValue  t,
int  q 
) [inline]
Remarks:
Sets the quality of the solve. This is the maximum number of iterations the solver will take to find the hit point. The lower quality the mire likely a particle will leak through the surface but the faster the solver will be.
Parameters:
TimeValue t

The time at which to set the quality.

int q

The quality value.
Default Implementation:
{ pblock->SetValue(collisionplane_quality,t,q); }
{ if (!pblock->GetControllerByID(collisionplane_quality)) pblock->SetValue(collisionplane_quality,t,q); }
void SetNode ( TimeValue  t,
INode n 
) [inline]
Remarks:
Sets the node which drives the TM to put the plane in world space.
Parameters:
TimeValue t

The time at which to set the node.

INode *n

The node to set.
Default Implementation:
{ pblock->SetValue(collisionplane_node,t,n); node = n; }
    { 
        {
            HoldSuspend hs;
            pblock->SetValue(collisionplane_node,t,n);
        }
        node = n; 
}
void SetWidth ( Control c ) [inline]
Remarks:
Sets the controller for the plane width.
Parameters:
Control *c

A pointer to the controller to set.
Default Implementation:
{ pblock->SetControllerByID(collisionplane_width,0,c); }
{ pblock->SetControllerByID(collisionplane_width,0,c,FALSE); }
void SetHeight ( Control c ) [inline]
Remarks:
Sets the controller for the plane height.
Parameters:
Control *c

A pointer to the controller to set.
Default Implementation:
{ pblock->SetControllerByID(collisionplane_height,0,c); }
{ pblock->SetControllerByID(collisionplane_height,0,c,FALSE); }
void SetQuality ( Control c ) [inline]
Remarks:
Sets the quality of the solve. This is the maximum number of iterations the solver will take to find the hit point. The lower quality the mire likely a particle will leak through the surface but the faster the solver will be.
Parameters:
Control *c

A pointer to the controller to set.
Default Implementation:
{ pblock->SetControllerByID(collisionplane_quality,0,c); }
{ pblock->SetControllerByID(collisionplane_quality,0,c,FALSE); }
void DeleteThis ( ) [virtual]
Remarks:
Self deletion.
Default Implementation:
{ delete this; }

Reimplemented from Animatable.

Class_ID ClassID ( ) [inline, virtual]
Remarks:
This method returns the class ID.
Default Implementation:
{return PLANAR_COLLISION_ID;}

Reimplemented from Animatable.

{return PLANAR_COLLISION_ID;}
SClass_ID SuperClassID ( ) [inline, virtual]
Remarks:
This method returns the super class ID.
Default Implementation:
{return REF_MAKER_CLASS_ID;}

Reimplemented from ReferenceTarget.

{return REF_MAKER_CLASS_ID;}
int NumRefs ( ) [inline, virtual]
Remarks:
This method returns the number of references.
Default Implementation:
{ return 1; }

Reimplemented from ReferenceMaker.

{ return 1; }
RefTargetHandle GetReference ( int  i ) [inline, virtual]
Remarks:
This method returns the I-th parameter block.
Default Implementation:
{ return pblock; }

Reimplemented from ReferenceMaker.

{ return pblock; }
virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [inline, protected, virtual]
Remarks:
This method allows you to set the I-th parameter block.
Parameters:
int i

The I-th parameter block to set.

RefTargetHandle rtarg

The reference target handle to the parameter block.
Default Implementation:
{pblock = (IParamBlock2*)rtarg;}

Reimplemented from ReferenceMaker.

{pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone ( RemapDir remap ) [virtual]
Remarks:
This method is called to have the plug-in clone itself. This method should copy both the data structure and all the data residing in the data structure of this reference target. The plug-in should clone all its references as well.
Parameters:
RemapDir &remap

This class is used for remapping references during a Clone. See Class RemapDir.
Returns:
A pointer to the cloned item.

Reimplemented from ReferenceTarget.

RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [virtual]
Remarks:
A plug-in which makes references must implement this method to receive and respond to messages broadcast by its dependents.
Parameters:
Interval changeInt

This is the interval of time over which the message is active.

RefTargetHandle hTarget

This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message.

PartID& partID

This contains information specific to the message passed in. Some messages don't use the PartID at all. See Reference Messages and PartID for more information.

RefMessage message

The msg parameters passed into this method is the specific message which needs to be handled. See Reference Messages.
Returns:
The return value from this method is of type RefResult. This is usually REF_SUCCEED indicating the message was processed. Sometimes, the return value may be REF_STOP. This return value is used to stop the message from being propagated to the dependents of the item.

Implements ReferenceMaker.


Member Data Documentation

float width
float height
int quality

CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane
CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane CollisionPlane