Implemented the same change in CharacterBody2D

This commit is contained in:
YoSoyFreeman 2024-11-18 22:06:13 +01:00
parent 91409f518d
commit 88c7bc28b7

View File

@ -352,14 +352,12 @@ void CharacterBody2D::_apply_floor_snap(bool p_wall_as_floor) {
floor_normal = result.collision_normal;
_set_platform_data(result);
if (floor_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.
if (result.travel.length() > margin) {
result.travel = up_direction * up_direction.dot(result.travel);
} else {
result.travel = Vector2();
}
// 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.
if (result.travel.length() > margin) {
result.travel = up_direction * up_direction.dot(result.travel);
} else {
result.travel = Vector2();
}
parameters.from.columns[2] += result.travel;