diff options
| author | sschirm <[email protected]> | 2016-12-23 14:20:36 +0100 |
|---|---|---|
| committer | sschirm <[email protected]> | 2016-12-23 14:56:17 +0100 |
| commit | ef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch) | |
| tree | 710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/GeomUtils/src/GuBox.cpp | |
| parent | Initial commit: (diff) | |
| download | physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip | |
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/GuBox.cpp')
| -rw-r--r-- | PhysX_3.4/Source/GeomUtils/src/GuBox.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
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); } |