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.
This commit is contained in:
PouleyKetchoupp 2021-06-09 17:33:17 -07:00
parent 92f20fd70e
commit 2bf145fa5d
2 changed files with 4 additions and 3 deletions

View file

@ -14,8 +14,8 @@
<member name="distance" type="float" setter="set_distance" getter="get_distance" default="0.0"> <member name="distance" type="float" setter="set_distance" getter="get_distance" default="0.0">
The line's distance from the origin. The line's distance from the origin.
</member> </member>
<member name="normal" type="Vector2" setter="set_normal" getter="get_normal" default="Vector2(0, 1)"> <member name="normal" type="Vector2" setter="set_normal" getter="get_normal" default="Vector2(0, -1)">
The line's normal. The line's normal. Defaults to [code]Vector2.UP[/code].
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -36,7 +36,8 @@
class LineShape2D : public Shape2D { class LineShape2D : public Shape2D {
GDCLASS(LineShape2D, 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; real_t distance = 0.0;
void _update_shape(); void _update_shape();