Move collider shape raycasting utilities to the PhysicsColliderActor class

This commit is contained in:
Wojtek Figat
2024-02-16 17:19:51 +01:00
parent 42b4443e14
commit 85f2910718
6 changed files with 55 additions and 70 deletions

View File

@@ -2630,6 +2630,7 @@ bool PhysicsBackend::RayCastShape(void* shape, const Vector3& position, const Qu
PxRaycastHit hit;
if (PxGeometryQuery::raycast(C2P(origin - sceneOrigin), C2P(direction), shapePhysX->getGeometry(), trans, maxDistance, SCENE_QUERY_FLAGS, 1, &hit) == 0)
return false;
hit.shape = shapePhysX;
P2C(hit, hitInfo);
hitInfo.Point += sceneOrigin;
return true;

View File

@@ -163,14 +163,11 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
c.ThisVelocity = c.OtherVelocity = Vector3::Zero;
if (hasPostVelocities && j.nextItemSet())
{
ASSERT(j.contactPairIndex == pairIndex);
ASSERT_LOW_LAYER(j.contactPairIndex == pairIndex);
if (j.postSolverVelocity)
{
const PxVec3 linearVelocityActor0 = j.postSolverVelocity->linearVelocity[0];
const PxVec3 linearVelocityActor1 = j.postSolverVelocity->linearVelocity[1];
c.ThisVelocity = P2C(linearVelocityActor0);
c.OtherVelocity = P2C(linearVelocityActor1);
c.ThisVelocity = P2C(j.postSolverVelocity->linearVelocity[0]);
c.OtherVelocity = P2C(j.postSolverVelocity->linearVelocity[1]);
}
}