diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index 31cfa5b597..420435b245 100755 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -870,9 +870,10 @@ void CharacterController::setMoveKinematically(bool kinematic) { bool CharacterController::queryPenetration(const btTransform& transform) { btVector3 minBox; btVector3 maxBox; - _ghost.queryPenetration(transform, minBox, maxBox); - btVector3 penetration = maxBox; - penetration.setMax(minBox.absolute()); + _ghost.setWorldTransform(transform); + _ghost.measurePenetration(minBox, maxBox); + btVector3 penetration = minBox; + penetration.setMax(maxBox.absolute()); const btScalar MIN_PENETRATION_SQUARED = 0.0016f; // 0.04^2 return penetration.length2() < MIN_PENETRATION_SQUARED; } diff --git a/libraries/physics/src/CharacterGhostObject.cpp b/libraries/physics/src/CharacterGhostObject.cpp index 07dc986c9e..328d869f01 100755 --- a/libraries/physics/src/CharacterGhostObject.cpp +++ b/libraries/physics/src/CharacterGhostObject.cpp @@ -242,17 +242,11 @@ bool CharacterGhostObject::sweepTest( return false; } -void CharacterGhostObject::queryPenetration(const btTransform& transform, btVector3& minBoxOut, btVector3& maxBoxOut) { - // place in world and refresh overlapping pairs - setWorldTransform(transform); - measurePenetration(minBoxOut, maxBoxOut); -} - void CharacterGhostObject::measurePenetration(btVector3& minBoxOut, btVector3& maxBoxOut) { // minBoxOut and maxBoxOut will be updated with penetration envelope. - // If one of the points is at <0,0,0> then the penetration may be resolvable in a single step, - // but if the space spanned by those two corners extends in both directions along at least one - // component then this object is sandwiched between two opposing objects. + // If one of the corner points is <0,0,0> then the penetration is resolvable in a single step, + // but if the space spanned by the two corners extends in both directions along at least one + // component then we the object is sandwiched between two opposing objects. // We assume this object has just been moved to its current location, or else objects have been // moved around it since the last step so we must update the overlapping pairs. diff --git a/libraries/physics/src/CharacterGhostObject.h b/libraries/physics/src/CharacterGhostObject.h index 9e3c5bb433..87310714c8 100755 --- a/libraries/physics/src/CharacterGhostObject.h +++ b/libraries/physics/src/CharacterGhostObject.h @@ -59,7 +59,6 @@ public: bool isSteppingUp() const { return _steppingUp; } const btVector3& getFloorNormal() const { return _floorNormal; } - void queryPenetration(const btTransform& transform, btVector3& minBoxOut, btVector3& maxBoxOut); void measurePenetration(btVector3& minBoxOut, btVector3& maxBoxOut); protected: