Fix issue with overlap callback
This commit is contained in:
parent
e03ee08462
commit
2efe9d65da
|
@ -149,7 +149,7 @@ class OverlapCallback {
|
|||
// -------------------- Methods -------------------- //
|
||||
|
||||
/// Constructor
|
||||
CallbackData(List<ContactPair>& contactPairs, List<ContactPair>& lostContactPairs, PhysicsWorld& world);
|
||||
CallbackData(List<ContactPair>& contactPairs, List<ContactPair>& lostContactPairs, bool onlyReportTriggers, PhysicsWorld& world);
|
||||
|
||||
/// Deleted copy constructor
|
||||
CallbackData(const CallbackData& callbackData) = delete;
|
||||
|
|
|
@ -67,7 +67,7 @@ OverlapCallback::OverlapPair::EventType OverlapCallback::OverlapPair::getEventTy
|
|||
}
|
||||
|
||||
// CollisionCallbackData Constructor
|
||||
OverlapCallback::CallbackData::CallbackData(List<ContactPair>& contactPairs, List<ContactPair>& lostContactPairs, PhysicsWorld& world)
|
||||
OverlapCallback::CallbackData::CallbackData(List<ContactPair>& contactPairs, List<ContactPair>& lostContactPairs, bool onlyReportTriggers, PhysicsWorld& world)
|
||||
:mContactPairs(contactPairs), mLostContactPairs(lostContactPairs),
|
||||
mContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mWorld(world) {
|
||||
|
||||
|
@ -75,7 +75,7 @@ OverlapCallback::CallbackData::CallbackData(List<ContactPair>& contactPairs, Lis
|
|||
for (uint i=0; i < mContactPairs.size(); i++) {
|
||||
|
||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||
if (mContactPairs[i].isTrigger) {
|
||||
if (!onlyReportTriggers || mContactPairs[i].isTrigger) {
|
||||
mContactPairsIndices.add(i);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ OverlapCallback::CallbackData::CallbackData(List<ContactPair>& contactPairs, Lis
|
|||
for (uint i=0; i < mLostContactPairs.size(); i++) {
|
||||
|
||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||
if (mLostContactPairs[i].isTrigger) {
|
||||
if (!onlyReportTriggers || mLostContactPairs[i].isTrigger) {
|
||||
mLostContactPairsIndices.add(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ bool CollisionDetectionSystem::computeNarrowPhaseOverlapSnapshot(NarrowPhaseInpu
|
|||
computeOverlapSnapshotContactPairs(narrowPhaseInput, contactPairs);
|
||||
|
||||
// Report overlapping colliders
|
||||
OverlapCallback::CallbackData callbackData(contactPairs, lostContactPairs, *mWorld);
|
||||
OverlapCallback::CallbackData callbackData(contactPairs, lostContactPairs, false, *mWorld);
|
||||
(*callback).onOverlap(callbackData);
|
||||
}
|
||||
|
||||
|
@ -1421,7 +1421,7 @@ void CollisionDetectionSystem::reportTriggers(EventListener& eventListener, List
|
|||
// If there are contacts
|
||||
if (contactPairs->size() + lostContactPairs.size() > 0) {
|
||||
|
||||
OverlapCallback::CallbackData callbackData(*contactPairs, lostContactPairs, *mWorld);
|
||||
OverlapCallback::CallbackData callbackData(*contactPairs, lostContactPairs, true, *mWorld);
|
||||
|
||||
// Call the callback method to report the overlapping shapes
|
||||
eventListener.onTrigger(callbackData);
|
||||
|
|
Loading…
Reference in New Issue
Block a user