diff options
| author | Rémi Verschelde | 2018-02-19 22:15:49 +0100 |
|---|---|---|
| committer | GitHub | 2018-02-19 22:15:49 +0100 |
| commit | b2aeb02e7d43d98973334e39db5c39626ba9f775 (patch) | |
| tree | d0d97ce31a873972558a01d7e12d3157f7162869 /modules/bullet/godot_ray_world_algorithm.cpp | |
| parent | 6ee4298ee3192e2c82e7b26b078f32302764ace5 (diff) | |
| parent | ffc3ef86778f486823bedf66cc5a937fc09abe6a (diff) | |
| download | godot-b2aeb02e7d43d98973334e39db5c39626ba9f775.tar.gz godot-b2aeb02e7d43d98973334e39db5c39626ba9f775.tar.zst godot-b2aeb02e7d43d98973334e39db5c39626ba9f775.zip | |
Diffstat (limited to 'modules/bullet/godot_ray_world_algorithm.cpp')
| -rw-r--r-- | modules/bullet/godot_ray_world_algorithm.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp index 4a511b39a..53d0ab7e3 100644 --- a/modules/bullet/godot_ray_world_algorithm.cpp +++ b/modules/bullet/godot_ray_world_algorithm.cpp @@ -100,14 +100,16 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo if (btResult.hasHit()) { - btVector3 ray_normal(ray_transform.getOrigin() - to.getOrigin()); - ray_normal.normalize(); btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1)); if (depth >= -RAY_STABILITY_MARGIN) depth = 0; - resultOut->addContactPoint(ray_normal, btResult.m_hitPointWorld, depth); + if (ray_shape->getSlipsOnSlope()) + resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth); + else { + resultOut->addContactPoint((ray_transform.getOrigin() - to.getOrigin()).normalize(), btResult.m_hitPointWorld, depth); + } } } |
