TP_CollisionInterface Struct Reference

#include <c4d_particles.h>

Detailed Description

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:

{
public:
TP_BaseCollision() { ci.base = this; }
Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct)
{
// ...
}
};
#define TP_Collision
Collision ID.
Definition: c4d_particles.h:190
Definition: c4d_particles.h:196
Definition: c4d_particles.h:747
void Py_ssize_t * pos
Definition: dictobject.h:50
maxon::Bool Bool
Definition: ge_sys_math.h:55
maxon::Int32 Int32
Definition: ge_sys_math.h:60
maxon::Float Float
Definition: ge_sys_math.h:66
Definition: c4d_particles.h:221
Bool(TP_BaseCollision::* CheckCollision)(Int32 collision, TP_MasterSystem *msys, Int32 pid, Float t, Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct)
Definition: c4d_particles.h:241
TP_BaseCollision * base
Base class pointer.
Definition: c4d_particles.h:222
Definition: c4d_particles.h:159

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_BaseCollisionbase
 
Bool(TP_BaseCollision::* CheckCollision )(Int32 collision, TP_MasterSystem *msys, Int32 pid, Float t, Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct)
 

Member Data Documentation

◆ base

Base class pointer.

◆ CheckCollision

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.

Parameters
[in]collisionThe collision ID. This is GvNode::GetOperatorID() for the node responsible for the collision.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()
[in]tThe time to evaluate the collision at. Collisions are detected between t - dt and tt.
[out]posAssign the new position of the object if there is a collision.
[out]velAssign the new velocity of the object if there is a collision.
[out]spinAssign the new spin of the object if there is a collision.
[in]dtThe time since the last evaluation, i.e. the time to look backwards for collisions.
[in]ctAssign the collision time, if there was a collision. This will generally be less than t.
Returns
true if there was a collision, otherwise false.