diff options
| author | Andrea Catania | 2018-02-25 21:05:14 +0100 |
|---|---|---|
| committer | Andrea Catania | 2018-02-25 21:05:14 +0100 |
| commit | 0e446f8aff57e382e5953397c0003b7c83f0d3d2 (patch) | |
| tree | 298407f26b5cd82e2a0f092e9f05e4b2334a49cd /modules/bullet/godot_result_callbacks.cpp | |
| parent | 125fc8cc4432d28e63da76c3a2aff655b1a7cc6b (diff) | |
| download | godot-0e446f8aff57e382e5953397c0003b7c83f0d3d2.tar.gz godot-0e446f8aff57e382e5953397c0003b7c83f0d3d2.tar.zst godot-0e446f8aff57e382e5953397c0003b7c83f0d3d2.zip | |
Fixed kinematic char sliding
Diffstat (limited to 'modules/bullet/godot_result_callbacks.cpp')
| -rw-r--r-- | modules/bullet/godot_result_callbacks.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index 7c051f8f1..72c982bb0 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -257,18 +257,15 @@ btScalar GodotRestInfoContactResultCallback::addSingleResult(btManifoldPoint &cp void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth) { - if (depth < 0) { - // Has penetration - if (m_most_penetrated_distance > depth) { + // Has penetration + if (m_penetration_distance < ABS(depth)) { - bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); + bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); - m_most_penetrated_distance = depth; - m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject(); - m_other_compound_shape_index = isSwapped ? m_index1 : m_index0; - m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld; - m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB; - m_penetration_distance = depth; - } + m_penetration_distance = depth; + m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject(); + m_other_compound_shape_index = isSwapped ? m_index1 : m_index0; + m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld; + m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB; } } |
