Skip to content

Commit

Permalink
Fix move_and_slide wall slide acceleration (3D)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rburing committed Apr 19, 2024
1 parent 4a01602 commit 80c600d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/3d/physics/character_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,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.
Expand Down

0 comments on commit 80c600d

Please sign in to comment.