Merge branch 'physx_oncontact_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-physx_oncontact_fix
This commit is contained in:
@@ -132,7 +132,8 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
|
|||||||
|
|
||||||
const PxReal* impulses = pair.contactImpulses;
|
const PxReal* impulses = pair.contactImpulses;
|
||||||
//const PxU32 flippedContacts = (pair.flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED);
|
//const PxU32 flippedContacts = (pair.flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED);
|
||||||
const PxU32 hasImpulses = (pair.flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES);
|
const bool hasImpulses = pair.flags.isSet(PxContactPairFlag::eINTERNAL_HAS_IMPULSES);
|
||||||
|
const bool hasPostVelocities = !pair.flags.isSet(PxContactPairFlag::eACTOR_PAIR_LOST_TOUCH);
|
||||||
PxU32 nbContacts = 0;
|
PxU32 nbContacts = 0;
|
||||||
PxVec3 totalImpulse(0.0f);
|
PxVec3 totalImpulse(0.0f);
|
||||||
|
|
||||||
@@ -166,7 +167,8 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract velocities
|
// Extract velocities
|
||||||
if (j.nextItemSet())
|
c.ThisVelocity = c.OtherVelocity = Vector3::Zero;
|
||||||
|
if (hasPostVelocities && j.nextItemSet())
|
||||||
{
|
{
|
||||||
ASSERT(j.contactPairIndex == pairIndex);
|
ASSERT(j.contactPairIndex == pairIndex);
|
||||||
if (j.postSolverVelocity)
|
if (j.postSolverVelocity)
|
||||||
@@ -177,10 +179,6 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
|
|||||||
c.ThisVelocity = P2C(linearVelocityActor0);
|
c.ThisVelocity = P2C(linearVelocityActor0);
|
||||||
c.OtherVelocity = P2C(linearVelocityActor1);
|
c.OtherVelocity = P2C(linearVelocityActor1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
c.ThisVelocity = c.OtherVelocity = Vector3::Zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ContactsCount = nbContacts;
|
c.ContactsCount = nbContacts;
|
||||||
@@ -195,6 +193,7 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
|
|||||||
RemovedCollisions.Add(c);
|
RemovedCollisions.Add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ASSERT(!j.nextItemSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationEventCallback::onTrigger(PxTriggerPair* pairs, PxU32 count)
|
void SimulationEventCallback::onTrigger(PxTriggerPair* pairs, PxU32 count)
|
||||||
|
|||||||
Reference in New Issue
Block a user