summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaniel Rakos <daniel.rakos@rastergrid.com>2019-02-20 15:04:36 +0100
committerDaniel Rakos <daniel.rakos@rastergrid.com>2019-02-20 15:06:08 +0100
commit6587024207c9c1d581e2440d1ad84df3648ec329 (patch)
treedbd2aa8b5c1d41d3b133279fa68a3dc7afe159ac /modules
parent75c89aaaef94a972fe257d5b6589862853847387 (diff)
Fix RayShape collision jitter when used with a RigidBody
Scaling the depth was the wrong solution for the KinematicBody jitter because it causes jitter with RigidBody. Instead scale the margin that is ignored to allow KinematicBody to still pick up the ray shape in the kinematic test when the shape is just at margin distance from another one. This solution does not cause jitter with either KinematicBody or RigidBody.
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index cadc8dd59e..3e06239453 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -100,8 +100,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo
btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1));
- if (depth >= -ray_shape->getMargin())
- depth *= 0.5;
+ if (depth >= -ray_shape->getMargin() * 0.5)
+ depth = 0;
if (ray_shape->getSlipsOnSlope())
resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth);