3ds Max C++ API Reference
CollisionObject Class Referenceabstract

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

#include <object.h>

+ Inheritance diagram for CollisionObject:

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. More...
 
virtual ObjectGetSWObject ()=0
 This method provides a way of identifying the 'parent' Deflector for a CollisionObject available to a particle system. More...
 
virtual void SetRandSeed (int seed)
 
virtual void DeleteThis ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

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

Member Function Documentation

◆ CheckCollision()

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
tThe time to check for collision.
posThe position of the particle to check and potentially modify.
velThe velocity vector of the particle to check and potentially modify.
dtThis is an increment of time - the step size. The method checks if the particle will collide in this amount of time.
indexThe index of the particle being collided.
ctAn array of floating point times at which the collisions occurred.
UpdatePastCollideThis 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.

◆ GetSWObject()

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.

◆ SetRandSeed()

virtual void SetRandSeed ( int  seed)
inlinevirtual
4131 {}

◆ DeleteThis()

virtual void DeleteThis ( )
inlinevirtual
4132 {}