Add motion parameter to toggle whether recovery is reported as a collision

This makes the intent explicit in each use case.
This commit is contained in:
Ricardo Buring
2022-04-28 22:44:09 +02:00
parent cdc5da7460
commit f072aa69a9
10 changed files with 45 additions and 26 deletions

View File

@@ -28,5 +28,9 @@
<member name="motion" type="Vector2" setter="set_motion" getter="get_motion" default="Vector2(0, 0)">
Motion vector to define the length and direction of the motion to test.
</member>
<member name="recovery_as_collision" type="bool" setter="set_recovery_as_collision_enabled" getter="is_recovery_as_collision_enabled" default="false">
If set to [code]true[/code], any depenetration from the recovery phase is reported as a collision; this is used e.g. by [method CharacterBody2D.move_and_slide] for improving floor detection when floor snapping is disabled.
If set to [code]false[/code], only collisions resulting from the motion are reported; this is used e.g. by [method PhysicsBody2D.move_and_collide].
</member>
</members>
</class>