MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / CallbackData

Method CallbackData

src/collision/CollisionCallback.cpp:79–103  ·  view source on GitHub ↗

Constructor

Source from the content-addressed store, hash-verified

77
78// Constructor
79CollisionCallback::CallbackData::CallbackData(Array<reactphysics3d::ContactPair>* contactPairs, Array<ContactManifold>* manifolds,
80 Array<reactphysics3d::ContactPoint>* contactPoints, Array<reactphysics3d::ContactPair>& lostContactPairs, PhysicsWorld& world)
81 :mContactPairs(contactPairs), mContactManifolds(manifolds), mContactPoints(contactPoints), mLostContactPairs(lostContactPairs),
82 mContactPairsIndices(world.mMemoryManager.getHeapAllocator(), contactPairs->size()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator(), lostContactPairs.size()),
83 mWorld(world) {
84
85 // Filter the contact pairs to only keep the contact events (not the overlap/trigger events)
86 const uint64 nbContactPairs = mContactPairs->size();
87 for (uint64 i=0; i < nbContactPairs; i++) {
88
89 // If the contact pair contains contacts (and is therefore not an overlap/trigger event)
90 if (!(*mContactPairs)[i].isTrigger) {
91 mContactPairsIndices.add(i);
92 }
93 }
94 // Filter the lost contact pairs to only keep the contact events (not the overlap/trigger events)
95 const uint64 nbLostContactPairs = mLostContactPairs.size();
96 for (uint64 i=0; i < nbLostContactPairs; i++) {
97
98 // If the contact pair contains contacts (and is therefore not an overlap/trigger event)
99 if (!mLostContactPairs[i].isTrigger) {
100 mLostContactPairsIndices.add(i);
101 }
102 }
103}
104
105// Return a given contact point of the contact pair
106/// Note that the returned ContactPoint object is only valid during the call of the CollisionCallback::onContact()

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected