diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 44b81dc0cc8..ce80bc508e3 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1309,9 +1309,6 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const motion = motion.slide(n); lv = lv.slide(n); } - - if (p_stop_on_slope) - break; } if (!found_collision) { diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 41f8ddaebe4..831764b40cb 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -518,6 +518,9 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t if (p_body->is_shape_set_as_disabled(i)) continue; + if (p_body->get_shape(i)->get_type() != Physics2DServer::SHAPE_RAY) + continue; + if (!shapes_found) { body_aabb = p_body->get_shape_aabb(i); shapes_found = true; @@ -632,6 +635,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t } if (ray_index != -1) { + Physics2DServer::SeparationResult &result = r_results[ray_index]; for (int k = 0; k < cbk.amount; k++) { @@ -709,6 +713,9 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co if (p_body->is_shape_set_as_disabled(i)) continue; + if (p_exclude_raycast_shapes && p_body->get_shape(i)->get_type() == Physics2DServer::SHAPE_RAY) + continue; + if (!shapes_found) { body_aabb = p_body->get_shape_aabb(i); shapes_found = true; @@ -1031,6 +1038,10 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co Transform2D body_shape_xform = ugt * p_body->get_shape_transform(j); Shape2DSW *body_shape = p_body->get_shape(j); + if (p_exclude_raycast_shapes && body_shape->get_type() == Physics2DServer::SHAPE_RAY) { + continue; + } + body_aabb.position += p_motion * unsafe; int amount = _cull_aabb_for_body(p_body, body_aabb);