summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDualMatrix <piet.goris@gmail.com>2018-11-29 02:24:33 +0100
committerDualMatrix <piet.goris@gmail.com>2018-11-29 02:24:33 +0100
commit86472ad5a99e0d597df13d2b8e930ed6ad24ef6c (patch)
tree0d86aed3a537dab1aa2023063042a97f47704412
parentf2ae14f3097c025382bd8645748f1d8b85560a2e (diff)
Fixed using move_and_slide with stop_on_slope stopping too early
This makes it stop exactly on the slope, I'm not 100% sure if this if this is the correct fix let me know what you think. Fixes #23675
-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();
}