:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/PhysicsTestMotionParameters2D.xml. .. _class_PhysicsTestMotionParameters2D: PhysicsTestMotionParameters2D ============================= **Inherits:** :ref:`RefCounted` **<** :ref:`Object` Parameters to be sent to a 2D body motion test. .. rst-class:: classref-introduction-group Description ----------- This class contains parameters used in :ref:`PhysicsServer2D.body_test_motion`. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`bool` | :ref:`collide_separation_ray` | ``false`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`RID[]` | :ref:`exclude_bodies` | ``[]`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int[]` | :ref:`exclude_objects` | ``[]`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Transform2D` | :ref:`from` | ``Transform2D(1, 0, 0, 1, 0, 0)`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`float` | :ref:`margin` | ``0.08`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Vector2` | :ref:`motion` | ``Vector2(0, 0)`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`bool` | :ref:`recovery_as_collision` | ``false`` | +---------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_PhysicsTestMotionParameters2D_property_collide_separation_ray: .. rst-class:: classref-property :ref:`bool` **collide_separation_ray** = ``false`` .. rst-class:: classref-property-setget - void **set_collide_separation_ray_enabled** **(** :ref:`bool` value **)** - :ref:`bool` **is_collide_separation_ray_enabled** **(** **)** If set to ``true``, shapes of type :ref:`PhysicsServer2D.SHAPE_SEPARATION_RAY` are used to detect collisions and can stop the motion. Can be useful when snapping to the ground. If set to ``false``, shapes of type :ref:`PhysicsServer2D.SHAPE_SEPARATION_RAY` are only used for separation when overlapping with other bodies. That's the main use for separation ray shapes. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_exclude_bodies: .. rst-class:: classref-property :ref:`RID[]` **exclude_bodies** = ``[]`` .. rst-class:: classref-property-setget - void **set_exclude_bodies** **(** :ref:`RID[]` value **)** - :ref:`RID[]` **get_exclude_bodies** **(** **)** Optional array of body :ref:`RID` to exclude from collision. Use :ref:`CollisionObject2D.get_rid` to get the :ref:`RID` associated with a :ref:`CollisionObject2D`-derived node. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_exclude_objects: .. rst-class:: classref-property :ref:`int[]` **exclude_objects** = ``[]`` .. rst-class:: classref-property-setget - void **set_exclude_objects** **(** :ref:`int[]` value **)** - :ref:`int[]` **get_exclude_objects** **(** **)** Optional array of object unique instance ID to exclude from collision. See :ref:`Object.get_instance_id`. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_from: .. rst-class:: classref-property :ref:`Transform2D` **from** = ``Transform2D(1, 0, 0, 1, 0, 0)`` .. rst-class:: classref-property-setget - void **set_from** **(** :ref:`Transform2D` value **)** - :ref:`Transform2D` **get_from** **(** **)** Transform in global space where the motion should start. Usually set to :ref:`Node2D.global_transform` for the current body's transform. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_margin: .. rst-class:: classref-property :ref:`float` **margin** = ``0.08`` .. rst-class:: classref-property-setget - void **set_margin** **(** :ref:`float` value **)** - :ref:`float` **get_margin** **(** **)** Increases the size of the shapes involved in the collision detection. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_motion: .. rst-class:: classref-property :ref:`Vector2` **motion** = ``Vector2(0, 0)`` .. rst-class:: classref-property-setget - void **set_motion** **(** :ref:`Vector2` value **)** - :ref:`Vector2` **get_motion** **(** **)** Motion vector to define the length and direction of the motion to test. .. rst-class:: classref-item-separator ---- .. _class_PhysicsTestMotionParameters2D_property_recovery_as_collision: .. rst-class:: classref-property :ref:`bool` **recovery_as_collision** = ``false`` .. rst-class:: classref-property-setget - void **set_recovery_as_collision_enabled** **(** :ref:`bool` value **)** - :ref:`bool` **is_recovery_as_collision_enabled** **(** **)** If set to ``true``, any depenetration from the recovery phase is reported as a collision; this is used e.g. by :ref:`CharacterBody2D` for improving floor detection during floor snapping. If set to ``false``, only collisions resulting from the motion are reported, which is generally the desired behavior. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`