#include <c4d_particles.h>
Callback interface for nodes that register collisions.
The easiest way to create this is to implement the TP_BaseCollision class:
This class is only forward-declared in c4d_particles.h, so as long as the linker approves this is fine.
Example:
In the TP_MSG_GET_COLLISIONINTERFACE message then simply set the passed TP_CollisionInterface pointer to &basecol.ci
, for a global TP_BaseCollision basecol
object that was previously created.
Thinking Particles will then call CheckCollision() as needed.
Public Attributes | |
TP_BaseCollision * | base |
Bool(TP_BaseCollision::* | CheckCollision )(Int32 collision, TP_MasterSystem *msys, Int32 pid, Float t, Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct) |
TP_BaseCollision* base |
Base class pointer.
Bool(TP_BaseCollision::* CheckCollision) (Int32 collision, TP_MasterSystem *msys, Int32 pid, Float t, Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct) |
Called by Thinking Particles when a collision handle is registered with TP_MasterSystem::SetCollision(), and provided Thinking Particles with a TP_CollisionInterface in the TP_MSG_GET_COLLISIONINTERFACE message.
Evaluate the passed collision parameters and set the output parameters. Thinking Particles will then update the particle values.
[in] | collision | The collision ID. This is GvNode::GetOperatorID() for the node responsible for the collision. |
[in] | msys | The master system. The caller owns the pointed TP_MasterSystem. |
[in] | pid | The particle ID: 0 <= pid < msys->NumParticles() |
[in] | t | The time to evaluate the collision at. Collisions are detected between t - dt and tt. |
[out] | pos | Assign the new position of the object if there is a collision. |
[out] | vel | Assign the new velocity of the object if there is a collision. |
[out] | spin | Assign the new spin of the object if there is a collision. |
[in] | dt | The time since the last evaluation, i.e. the time to look backwards for collisions. |
[in] | ct | Assign the collision time, if there was a collision. This will generally be less than t. |