aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
diff options
context:
space:
mode:
authorSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
committerSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
commit238605d8225a9135d6b60646e05d066e25424eee (patch)
tree2b013bd4946bb3c699d7a06ef1f21be85d367f63 /PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
parentAdd ParamTool.exe (diff)
downloadphysx-3.4-238605d8225a9135d6b60646e05d066e25424eee.tar.xz
physx-3.4-238605d8225a9135d6b60646e05d066e25424eee.zip
PhysX 3.4, APEX 1.4 patch release @23879214
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp')
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
index c56f4df5..0a18286b 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
@@ -62,19 +62,18 @@ bool pcmContactSphereSphere(GU_CONTACT_METHOD_ARGS)
if(FAllGrtr(FMul(inflatedSum, inflatedSum), distanceSq))
{
const FloatV eps = FLoad(0.00001f);
- const FloatV nhalf = FLoad(-0.5f);
- const FloatV magn = FSqrt(distanceSq);
- const BoolV bCon = FIsGrtrOrEq(eps, magn);
- const Vec3V normal = V3Sel(bCon, V3UnitX(), V3ScaleInv(_delta, magn));
- const FloatV scale = FMul(FSub(FAdd(r0, magn), r1), nhalf);
- const Vec3V point = V3ScaleAdd(normal, scale, p0);
- const FloatV dist = FSub(magn, radiusSum);
+ const FloatV dist = FSqrt(distanceSq);
+ const BoolV bCon = FIsGrtrOrEq(eps, dist);
+ const Vec3V normal = V3Sel(bCon, V3UnitX(), V3ScaleInv(_delta, dist));
+
+ const Vec3V point = V3ScaleAdd(normal, r1, p1);
+ const FloatV pen = FSub(dist, radiusSum);
PX_ASSERT(contactBuffer.count < ContactBuffer::MAX_CONTACTS);
Gu::ContactPoint& contact = contactBuffer.contacts[contactBuffer.count++];
V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x);
V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x);
- FStore(dist, &contact.separation);
+ FStore(pen, &contact.separation);
contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX;