Public Member Functions

CollisionObject Class Reference

Search for all occurrences

Detailed Description

A collision object can be applied to a particle system by a Space Warp.

The collision object checks a particle's position and velocity and determines if the particle will collide with it in the next dt amount of time. If so, it modifies the position and velocity.

See also:
Class Point3

#include <object.h>

Inheritance diagram for CollisionObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual BOOL  CheckCollision (TimeValue t, Point3 &pos, Point3 &vel, float dt, int index, float *ct=NULL, BOOL UpdatePastCollide=TRUE)=0
  This method checks a particles position and velocity to determine if there was be a collision between the particle and this collision object.
virtual Object GetSWObject ()=0
  This method provides a way of identifying the 'parent' Deflector for a CollisionObject available to a particle system.
virtual void  SetRandSeed (int seed)
virtual void  DeleteThis ()

Member Function Documentation

virtual BOOL CheckCollision ( TimeValue  t,
Point3 pos,
Point3 vel,
float  dt,
int  index,
float *  ct = NULL,
BOOL  UpdatePastCollide = TRUE 
) [pure virtual]

This method checks a particles position and velocity to determine if there was be a collision between the particle and this collision object.

If there was a collision, the particles position and velocity should be modified. The plug-in may compute a line segment between where the particle is now, and where it will be in dt amount of time. The plug-in then checks if the line segment intersects the collision object. If so, it would compute the resulting position, and modify the velocity vector vel to point in the new direction (presumably reflected across the surface normal). 3ds Max 3.0 introduced interparticle collision (where particles may collide with other particles). In order to implement interparticle collision (IPC) in the presence of collision objects, it became necessary to generalize the operation of the deflectors so that they didn't always work in discrete time intervals. That is, in the general case of an unidentified number of particles interacting in an unspecified way, it was necessary to allow everything involved in that system to update to specified times without moving past that time. In the absence of IPC enabled, the particle system calls the bound collision objects with the parameter UpdatePastCollide == TRUE, and the deflector checks all collisions, updates particles based on their collisions with deflectors and the ensuing, remaining time intervals in dt subsequent to the collisions. In the presence of IPC that won't work. When IPC is active, all particles need to be updated to the time of the first collision in the system in dt, whether that collision be between particles or between particles and deflectors. Thus, in the presence of IPC, all particle updates to bound deflectors are called with UpdatePastCollide == FALSE. In that case, the collision objects return both the position and velocity of the updated particles and the time at which the collision occurred. All such times are compared, along with all possible internally calculated IPC event times. If there are any nonnegative times returned greater than or equal to zero, all particle states are reverted to their states at the beginning of the interval and then updated to the precise minimum time returned as the earliest collision. And then everything starts up again trying to update itself to the next integral time, when control can pass back to whatever is asking the particles to update themselves. If there are other collisions in that time, it happens again. This whole set of operations happens after any true returns from the trilinear sort/sweep correlator that looks for the possibility of collisions. If there are no possible collisions, everything proceeds through a complete interval normally.

Parameters:
t The time to check for collision.
pos The position of the particle to check and potentially modify.
vel The velocity vector of the particle to check and potentially modify.
dt This is an increment of time - the step size. The method checks if the particle will collide in this amount of time.
index The index of the particle being collided.
ct An array of floating point times at which the collisions occurred.
UpdatePastCollide This is a flag to tell the collision object to update the particle past the collision to the remainder of input dt or to output the state of the particle at the collision. In the presence of interparticle collision enable, we have to update to the times of collisions and then retest from there. See the Remarks.
Returns:
TRUE if there was a collision and the position and velocity have been modified; otherwise FALSE.
virtual Object* GetSWObject ( ) [pure virtual]

This method provides a way of identifying the 'parent' Deflector for a CollisionObject available to a particle system.

This must be implemented by all Deflectors. It returns the object pointer to the Deflector from which the Collision object is derived.

virtual void SetRandSeed ( int  seed ) [inline, virtual]
virtual void DeleteThis ( ) [inline, virtual]

CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject
CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject CollisionObject