From ef6937e69e8ee3f409cf9d460d5ad300a65d5924 Mon Sep 17 00:00:00 2001 From: sschirm Date: Fri, 23 Dec 2016 14:20:36 +0100 Subject: PhysX 3.4 / APEX 1.4 release candidate @21506124 --- PhysX_3.4/Source/GeomUtils/src/GuBox.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'PhysX_3.4/Source/GeomUtils/src/GuBox.cpp') diff --git a/PhysX_3.4/Source/GeomUtils/src/GuBox.cpp b/PhysX_3.4/Source/GeomUtils/src/GuBox.cpp index 5b91d443..f75b9158 100644 --- a/PhysX_3.4/Source/GeomUtils/src/GuBox.cpp +++ b/PhysX_3.4/Source/GeomUtils/src/GuBox.cpp @@ -42,17 +42,21 @@ void Gu::Box::create(const Gu::Capsule& capsule) // Box center = center of the two LSS's endpoints center = capsule.computeCenter(); - PxVec3 dir = capsule.p1 - capsule.p0; + // Box orientation + const PxVec3 dir = capsule.p1 - capsule.p0; const float d = dir.magnitude(); - rot.column0 = dir / d; + if(d!=0.0f) + { + rot.column0 = dir / d; + Ps::computeBasis(rot.column0, rot.column1, rot.column2); + } + else + rot = PxMat33(PxIdentity); // Box extents extents.x = capsule.radius + (d * 0.5f); extents.y = capsule.radius; extents.z = capsule.radius; - - // Box orientation - Ps::computeBasis(rot.column0, rot.column1, rot.column2); } -- cgit v1.2.3