Fix ComputeShapeSqrDistanceToPoint on PhysX with Large Worlds

#3023
This commit is contained in:
Wojtek Figat
2024-10-28 20:47:53 +01:00
parent 04ac3160e4
commit ae4a4a8e57

View File

@@ -2801,7 +2801,14 @@ float PhysicsBackend::ComputeShapeSqrDistanceToPoint(void* shape, const Vector3&
{
auto shapePhysX = (PxShape*)shape;
const PxTransform trans(C2P(position), C2P(orientation));
#if USE_LARGE_WORLDS
PxVec3 closestPointPx;
float result = PxGeometryQuery::pointDistance(C2P(point), shapePhysX->getGeometry(), trans, &closestPointPx);
*closestPoint = P2C(closestPointPx);
return result;
#else
return PxGeometryQuery::pointDistance(C2P(point), shapePhysX->getGeometry(), trans, (PxVec3*)closestPoint);
#endif
}
bool PhysicsBackend::RayCastShape(void* shape, const Vector3& position, const Quaternion& orientation, const Vector3& origin, const Vector3& direction, float& resultHitDistance, float maxDistance)