3ds Max C++ API Reference
CollisionOps Class Referenceabstract

#include <icollision.h>

+ Inheritance diagram for CollisionOps:

Public Member Functions

virtual int SuppportedCollisions (ReferenceTarget *r)=0
 
virtual void PreFrame (ReferenceTarget *r, TimeValue &t, TimeValue &dt)=0
 
virtual void PostFrame (ReferenceTarget *r, TimeValue &t, TimeValue &dt)=0
 
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t, Point3 *pos, Point3 *vel, float &dt, float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel)=0
 
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
 
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t, Point3 *boxCenter, float &w, float &h, float &d, Point3 *vel, float &dt, float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel)=0
 
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
 
- Public Member Functions inherited from FPInterface
virtual BaseInterfaceGetInterface (Interface_ID id)
 
virtual FPInterfaceDescGetDesc ()=0
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
virtual ActionTableGetActionTable ()
 
virtual void EnableActions (BOOL onOff)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual UtilExport Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- 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...
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Detailed Description

See also
Class ICollision, Class CollisionPlane, Class CollisionSphere, Class CollisionVNormal, Class CollisionMesh, Class Box3, Class Point3, Class FPInterface

Description:
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).

Member Function Documentation

◆ SuppportedCollisions()

virtual int SuppportedCollisions ( ReferenceTarget r)
pure virtual
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.
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.

◆ PreFrame()

virtual void PreFrame ( ReferenceTarget r,
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:
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.

◆ PostFrame()

virtual void PostFrame ( ReferenceTarget r,
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:
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.

◆ CheckCollision() [1/4]

virtual BOOL CheckCollision ( ReferenceTarget r,
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:
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.
Returns
TRUE if there's a collision, otherwise FALSE.

◆ CheckCollision() [2/4]

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 
)
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:
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.
Returns
TRUE if there's a collision, otherwise FALSE.

◆ CheckCollision() [3/4]

virtual BOOL CheckCollision ( ReferenceTarget r,
TimeValue t,
Point3 boxCenter,
float &  w,
float &  h,
float &  d,
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:
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.
Returns
TRUE if there's a collision, otherwise FALSE.

◆ CheckCollision() [4/4]

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 
)
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:
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.
Returns
TRUE if there's a collision, otherwise FALSE.