From 32262931ca8ceaadcdfbfdf39d23fde22a5cfd7d Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Fri, 19 Apr 2024 19:40:01 +0200 Subject: [PATCH] Fix move_and_slide wall slide acceleration (3D) When travel is high enough, keep the global position resulting from the move_and_collide call, and set the motion to the remainder from the move_and_collide call. This ensures travel is taken into account once, rather than twice. (cherry picked from commit 80c600d86b6fed05fdb35d5dd95267a8a95fe74d) --- scene/3d/physics_body_3d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index ed64c165640..dc3b8f94c40 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1362,7 +1362,7 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo } else { // Travel is too high to be safely canceled, we take it into account. result.travel = result.travel.slide(up_direction); - motion = motion.normalized() * result.travel.length(); + motion = result.remainder; } set_global_transform(gt); // Determines if you are on the ground, and limits the possibility of climbing on the walls because of the approximations.