summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-12-14 13:57:19 +0100
committerGitHub <noreply@github.com>2018-12-14 13:57:19 +0100
commit661e5e873b0ed2c91ac0bd31a3a8aafb2dfe98a3 (patch)
treed726d58e98b033eb3eecb8ebc5e9b46e0ffe446a
parent31aaff3b21fae4e6161edb52876aa9893a65ed34 (diff)
parent86472ad5a99e0d597df13d2b8e930ed6ad24ef6c (diff)
Merge pull request #24046 from DualMatrix/stop_slope
Fixed using move_and_slide with stop_on_slope stopping too early
-rw-r--r--scene/2d/physics_body_2d.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 3dde228bfa..d6b301e10d 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1293,7 +1293,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
if (p_stop_on_slope) {
if (Vector2() == lv_n + p_floor_direction) {
Transform2D gt = get_global_transform();
- gt.elements[2] -= collision.travel;
+ gt.elements[2] -= collision.travel.project(p_floor_direction.tangent());
set_global_transform(gt);
return Vector2();
}