summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorgamemanj <gamemanj@hotmail.co.uk>2017-04-15 10:20:27 +0100
committergamemanj <gamemanj@hotmail.co.uk>2017-04-15 10:24:36 +0100
commit0a4dde93d4ae5b83b8cea280a7711c7469de1686 (patch)
treeca4741977550df48f1215379bc512cbd8a741b01 /scene
parentb7ce1601a373347c617b09b5461bda4112f9855f (diff)
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.
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/physics_body_2d.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index f752cbf6b6..626ea10515 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/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;