|
@@ -58,9 +58,9 @@ Methods
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`KinematicCollision2D<class_KinematicCollision2D>` | :ref:`move_and_collide<class_KinematicBody2D_method_move_and_collide>` **(** :ref:`Vector2<class_Vector2>` rel_vec, :ref:`bool<class_bool>` infinite_inertia=true, :ref:`bool<class_bool>` exclude_raycast_shapes=true, :ref:`bool<class_bool>` test_only=false **)** |
|
|
| :ref:`KinematicCollision2D<class_KinematicCollision2D>` | :ref:`move_and_collide<class_KinematicBody2D_method_move_and_collide>` **(** :ref:`Vector2<class_Vector2>` rel_vec, :ref:`bool<class_bool>` infinite_inertia=true, :ref:`bool<class_bool>` exclude_raycast_shapes=true, :ref:`bool<class_bool>` test_only=false **)** |
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
-| :ref:`Vector2<class_Vector2>` | :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>` **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` floor_normal=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
|
|
|
|
+| :ref:`Vector2<class_Vector2>` | :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>` **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` up_direction=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
-| :ref:`Vector2<class_Vector2>` | :ref:`move_and_slide_with_snap<class_KinematicBody2D_method_move_and_slide_with_snap>` **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` snap, :ref:`Vector2<class_Vector2>` floor_normal=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
|
|
|
|
+| :ref:`Vector2<class_Vector2>` | :ref:`move_and_slide_with_snap<class_KinematicBody2D_method_move_and_slide_with_snap>` **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` snap, :ref:`Vector2<class_Vector2>` up_direction=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`test_move<class_KinematicBody2D_method_test_move>` **(** :ref:`Transform2D<class_Transform2D>` from, :ref:`Vector2<class_Vector2>` rel_vec, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
| :ref:`bool<class_bool>` | :ref:`test_move<class_KinematicBody2D_method_test_move>` **(** :ref:`Transform2D<class_Transform2D>` from, :ref:`Vector2<class_Vector2>` rel_vec, :ref:`bool<class_bool>` infinite_inertia=true **)** |
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
@@ -105,7 +105,7 @@ Method Descriptions
|
|
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_floor_normal** **(** **)** const
|
|
- :ref:`Vector2<class_Vector2>` **get_floor_normal** **(** **)** const
|
|
|
|
|
|
-Returns the normal vector of the floor.
|
|
|
|
|
|
+Returns the surface normal of the floor at the last collision point. Only valid after calling :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>` or :ref:`move_and_slide_with_snap<class_KinematicBody2D_method_move_and_slide_with_snap>` and when :ref:`is_on_floor<class_KinematicBody2D_method_is_on_floor>` returns ``true``.
|
|
|
|
|
|
----
|
|
----
|
|
|
|
|
|
@@ -113,7 +113,7 @@ Returns the normal vector of the floor.
|
|
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_floor_velocity** **(** **)** const
|
|
- :ref:`Vector2<class_Vector2>` **get_floor_velocity** **(** **)** const
|
|
|
|
|
|
-Returns the velocity of the floor. Only updates when calling :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>`.
|
|
|
|
|
|
+Returns the linear velocity of the floor at the last collision point. Only valid after calling :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>` or :ref:`move_and_slide_with_snap<class_KinematicBody2D_method_move_and_slide_with_snap>` and when :ref:`is_on_floor<class_KinematicBody2D_method_is_on_floor>` returns ``true``.
|
|
|
|
|
|
----
|
|
----
|
|
|
|
|
|
@@ -177,13 +177,13 @@ If ``test_only`` is ``true``, the body does not move but the would-be collision
|
|
|
|
|
|
.. _class_KinematicBody2D_method_move_and_slide:
|
|
.. _class_KinematicBody2D_method_move_and_slide:
|
|
|
|
|
|
-- :ref:`Vector2<class_Vector2>` **move_and_slide** **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` floor_normal=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)**
|
|
|
|
|
|
+- :ref:`Vector2<class_Vector2>` **move_and_slide** **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` up_direction=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)**
|
|
|
|
|
|
Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a ``KinematicBody2D`` or :ref:`RigidBody2D<class_RigidBody2D>`, it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
|
|
Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a ``KinematicBody2D`` or :ref:`RigidBody2D<class_RigidBody2D>`, it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
|
|
|
|
|
|
``linear_velocity`` is the velocity vector in pixels per second. Unlike in :ref:`move_and_collide<class_KinematicBody2D_method_move_and_collide>`, you should *not* multiply it by ``delta`` — the physics engine handles applying the velocity.
|
|
``linear_velocity`` is the velocity vector in pixels per second. Unlike in :ref:`move_and_collide<class_KinematicBody2D_method_move_and_collide>`, you should *not* multiply it by ``delta`` — the physics engine handles applying the velocity.
|
|
|
|
|
|
-``floor_normal`` is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of ``Vector2(0, 0)``, everything is considered a wall. This is useful for topdown games.
|
|
|
|
|
|
+``up_direction`` is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of ``Vector2(0, 0)``, everything is considered a wall. This is useful for topdown games.
|
|
|
|
|
|
If ``stop_on_slope`` is ``true``, body will not slide on slopes when you include gravity in ``linear_velocity`` and the body is standing still.
|
|
If ``stop_on_slope`` is ``true``, body will not slide on slopes when you include gravity in ``linear_velocity`` and the body is standing still.
|
|
|
|
|
|
@@ -199,7 +199,7 @@ Returns the ``linear_velocity`` vector, rotated and/or scaled if a slide collisi
|
|
|
|
|
|
.. _class_KinematicBody2D_method_move_and_slide_with_snap:
|
|
.. _class_KinematicBody2D_method_move_and_slide_with_snap:
|
|
|
|
|
|
-- :ref:`Vector2<class_Vector2>` **move_and_slide_with_snap** **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` snap, :ref:`Vector2<class_Vector2>` floor_normal=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)**
|
|
|
|
|
|
+- :ref:`Vector2<class_Vector2>` **move_and_slide_with_snap** **(** :ref:`Vector2<class_Vector2>` linear_velocity, :ref:`Vector2<class_Vector2>` snap, :ref:`Vector2<class_Vector2>` up_direction=Vector2( 0, 0 ), :ref:`bool<class_bool>` stop_on_slope=false, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398, :ref:`bool<class_bool>` infinite_inertia=true **)**
|
|
|
|
|
|
Moves the body while keeping it attached to slopes. Similar to :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>`.
|
|
Moves the body while keeping it attached to slopes. Similar to :ref:`move_and_slide<class_KinematicBody2D_method_move_and_slide>`.
|
|
|
|
|