diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-02-27 11:40:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-27 11:40:11 +0100 |
commit | 4b9ab27deabf52de85e86bf69946814ec766c3e1 (patch) | |
tree | 8779e7771d0fddf851a438c302ce50cf71c70957 /modules/bullet/godot_result_callbacks.cpp | |
parent | 6093660bfb50c76ca9e1bda74bc80e118f44b7a4 (diff) | |
parent | 0e446f8aff57e382e5953397c0003b7c83f0d3d2 (diff) |
Merge pull request #17021 from AndreaCatania/kinfix
Fixed bullet kinematic char sliding
Diffstat (limited to 'modules/bullet/godot_result_callbacks.cpp')
-rw-r--r-- | modules/bullet/godot_result_callbacks.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index 7c051f8f17..72c982bb0b 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) { - - 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; - } + // Has penetration + if (m_penetration_distance < ABS(depth)) { + + bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); + + 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; } } |