From 81f62d68c2e2f244671ecfa31e6e12809bfe2f4d Mon Sep 17 00:00:00 2001 From: Demiu Date: Mon, 15 Jul 2019 01:59:18 +0200 Subject: [PATCH 1/2] Fix KinematicBody::move_and_slide --- scene/3d/physics_body.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 2f8b2ecc5ce..e60a50d38aa 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1218,7 +1218,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve if (p_stop_on_slope) { if ((lv_n + p_floor_direction).length() < 0.01 && collision.travel.length() < 1) { Transform gt = get_global_transform(); - gt.origin -= collision.travel; + gt.origin -= collision.travel.slide(p_floor_direction); set_global_transform(gt); return Vector3(); } From fead4e369a278aebc4730b04776539e31dd17898 Mon Sep 17 00:00:00 2001 From: Demiu Date: Mon, 15 Jul 2019 14:09:29 +0200 Subject: [PATCH 2/2] Change p_stop_on_slope in 3D move_and_slide_with_snap --- scene/3d/physics_body.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index e60a50d38aa..156f115cce4 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1282,7 +1282,7 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity if (p_stop_on_slope) { // move and collide may stray the object a bit because of pre un-stucking, // so only ensure that motion happens on floor direction in this case. - col.travel = p_floor_direction * p_floor_direction.dot(col.travel); + col.travel = col.travel.project(p_floor_direction); } } else { apply = false; //snapped with floor direction, but did not snap to a floor, do not snap.