From 2bf145fa5d3efaea6d0e108da19c212ceeff6505 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 9 Jun 2021 17:33:17 -0700 Subject: [PATCH] Make LineShape2D normal point upwards by default Allows line shapes to collide with objects falling from the top by default, which makes more sense for the most common cases. --- doc/classes/LineShape2D.xml | 4 ++-- scene/resources/line_shape_2d.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/classes/LineShape2D.xml b/doc/classes/LineShape2D.xml index fed57735834..434e6fba8e2 100644 --- a/doc/classes/LineShape2D.xml +++ b/doc/classes/LineShape2D.xml @@ -14,8 +14,8 @@ The line's distance from the origin. - - The line's normal. + + The line's normal. Defaults to [code]Vector2.UP[/code]. diff --git a/scene/resources/line_shape_2d.h b/scene/resources/line_shape_2d.h index 9f0405ad295..210a1aa9e6d 100644 --- a/scene/resources/line_shape_2d.h +++ b/scene/resources/line_shape_2d.h @@ -36,7 +36,8 @@ class LineShape2D : public Shape2D { GDCLASS(LineShape2D, Shape2D); - Vector2 normal = Vector2(0, 1); + // LineShape2D is often used for one-way platforms, where the normal pointing up makes sense. + Vector2 normal = Vector2(0, -1); real_t distance = 0.0; void _update_shape();