Parcourir la source

Apply is_ceiling/is_wall swap fix to 2D move_and_slide (minus explaination)

As it turns out, is_ceiling would be true when hitting a wall,
 and is_wall would be true momentarily when hitting a ceiling.

This makes a tiny one-line change to fix that.
Without trying to explain the code for anyone else having to
 mess around with it.
gamemanj il y a 8 ans
Parent
commit
0a4dde93d4
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      scene/2d/physics_body_2d.cpp

+ 1 - 1
scene/2d/physics_body_2d.cpp

@@ -1199,7 +1199,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
 						revert_motion();
 						return Vector2();
 					}
-				} else if (get_collision_normal().dot(-p_floor_direction) <= Math::cos(p_floor_max_angle)) { //ceiling
+				} else if (get_collision_normal().dot(-p_floor_direction) >= Math::cos(p_floor_max_angle)) { //ceiling
 					move_and_slide_on_ceiling = true;
 				} else {
 					move_and_slide_on_wall = true;