diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-02 18:03:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 18:03:58 +0200 |
commit | 262924296b08b9065816e68e756a42c3963fa1ed (patch) | |
tree | 96dc50fe3e12f479142777df354e16504f93f8a3 /modules/bullet/godot_ray_world_algorithm.cpp | |
parent | a2213bfb601dd104179ec69c6103d735202371a9 (diff) | |
parent | 6dd65c0d67960b0f0b26a24bd2f10fe8d54aa37a (diff) |
Merge pull request #27415 from aqnuep/kinematicbody_fixes
KinematicBody performance and quality improvements
Diffstat (limited to 'modules/bullet/godot_ray_world_algorithm.cpp')
-rw-r--r-- | modules/bullet/godot_ray_world_algorithm.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp index 3e06239453..2ba75b9a98 100644 --- a/modules/bullet/godot_ray_world_algorithm.cpp +++ b/modules/bullet/godot_ray_world_algorithm.cpp @@ -39,6 +39,9 @@ @author AndreaCatania */ +// Epsilon to account for floating point inaccuracies +#define RAY_PENETRATION_DEPTH_EPSILON 0.01 + GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) : m_world(world) {} @@ -100,8 +103,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1)); - if (depth >= -ray_shape->getMargin() * 0.5) - depth = 0; + if (depth > -RAY_PENETRATION_DEPTH_EPSILON) + depth = 0.0; if (ray_shape->getSlipsOnSlope()) resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth); |