From e1f2feec2eccbc0589a66b84ea8b3af34c1740b4 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 16 Jul 2018 21:30:44 -0300 Subject: Changes to how snap works (I think this makes more sense now) --- scene/2d/physics_body_2d.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scene/2d/physics_body_2d.h') diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 5ab07cc754..1873c977a9 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -290,21 +290,22 @@ private: bool on_floor; bool on_ceiling; bool on_wall; - bool snapped; + Vector colliders; Vector > slide_colliders; Ref motion_cache; _FORCE_INLINE_ bool _ignores_mode(Physics2DServer::BodyMode) const; - Ref _move(const Vector2 &p_motion, bool p_infinite_inertia = true, bool p_exclude_raycast_shapes = true, bool p_only_move_if_collided = false, float p_custom_margin = -1); + Ref _move(const Vector2 &p_motion, bool p_infinite_inertia = true, bool p_exclude_raycast_shapes = true); Ref _get_slide_collision(int p_bounce); protected: static void _bind_methods(); public: - bool move_and_collide(const Vector2 &p_motion, bool p_infinite_inertia, Collision &r_collision, bool p_exclude_raycast_shapes = true, bool p_only_move_if_collided = false, float p_custom_margin = -1); + bool move_and_collide(const Vector2 &p_motion, bool p_infinite_inertia, Collision &r_collision, bool p_exclude_raycast_shapes = true); + bool snap_to_floor(const Vector2 &p_direction, float p_floor_max_angle = Math::deg2rad((float)45)); bool test_move(const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia); bool separate_raycast_shapes(bool p_infinite_inertia, Collision &r_collision); @@ -312,7 +313,7 @@ public: void set_safe_margin(float p_margin); float get_safe_margin() const; - Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), bool p_infinite_inertia = true, float p_slope_stop_min_velocity = 5, int p_max_slides = 4, float p_floor_max_angle = Math::deg2rad((float)45), const Vector2 &p_snap = Vector2()); + Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), bool p_infinite_inertia = true, float p_slope_stop_min_velocity = 5, int p_max_slides = 4, float p_floor_max_angle = Math::deg2rad((float)45)); bool is_on_floor() const; bool is_on_wall() const; bool is_on_ceiling() const; -- cgit v1.2.3