Avoid to snap when the body is already on the floor.
This commit is contained in:
parent
bf383a31cb
commit
2cb364bab1
@ -1212,7 +1212,7 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci
|
||||
bool was_on_floor = on_floor;
|
||||
|
||||
Vector2 ret = move_and_slide(p_linear_velocity, up_direction, p_stop_on_slope, p_max_slides, p_floor_max_angle, p_infinite_inertia);
|
||||
if (!was_on_floor || p_snap == Vector2()) {
|
||||
if (!was_on_floor || p_snap == Vector2() || on_floor) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity
|
||||
bool was_on_floor = on_floor;
|
||||
|
||||
Vector3 ret = move_and_slide(p_linear_velocity, up_direction, p_stop_on_slope, p_max_slides, p_floor_max_angle, p_infinite_inertia);
|
||||
if (!was_on_floor || p_snap == Vector3()) {
|
||||
if (!was_on_floor || p_snap == Vector3() || on_floor) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user