summaryrefslogtreecommitdiffstats
path: root/modules/bullet/godot_ray_world_algorithm.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-02-19 14:42:04 +0100
committerGitHub <noreply@github.com>2019-02-19 14:42:04 +0100
commit2f9b7e6b6330888fca0b74dfe634a9c438f44dfb (patch)
tree2c1e8ed2d1bb5189a0b3d14454522e7f50669537 /modules/bullet/godot_ray_world_algorithm.cpp
parentb7c50d99af9f6c18b8d8324ed9d215ee9b01e200 (diff)
parentf7511511b12977d0385198ea0037ef4c62e75d47 (diff)
downloadredot-engine-2f9b7e6b6330888fca0b74dfe634a9c438f44dfb.tar.gz
Merge pull request #25788 from aqnuep/rayshape_fix
Fix RayShape collision when used with a KinematicBody (Bullet Physics)
Diffstat (limited to 'modules/bullet/godot_ray_world_algorithm.cpp')
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index 449f625e17..cadc8dd59e 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -35,8 +35,6 @@
#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
-#define RAY_STABILITY_MARGIN 0.1
-
/**
@author AndreaCatania
*/
@@ -102,8 +100,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo
btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1));
- if (depth >= -RAY_STABILITY_MARGIN)
- depth = 0;
+ if (depth >= -ray_shape->getMargin())
+ depth *= 0.5;
if (ray_shape->getSlipsOnSlope())
resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth);