mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
classref: Sync with current master branch (f87858a8f)
This commit is contained in:
@@ -16,11 +16,15 @@ PhysicsDirectSpaceState2D
|
||||
|
||||
Direct access object to a space in the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Direct access object to a space in the :ref:`PhysicsServer2D<class_PhysicsServer2D>`. It's used mainly to do queries against objects and areas residing in a given space.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Tutorials
|
||||
---------
|
||||
|
||||
@@ -28,29 +32,42 @@ Tutorials
|
||||
|
||||
- :doc:`Ray-casting <../tutorials/physics/ray-casting>`
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`cast_motion<class_PhysicsDirectSpaceState2D_method_cast_motion>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedVector2Array[]<class_PackedVector2Array>` | :ref:`collide_shape<class_PhysicsDirectSpaceState2D_method_collide_shape>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_rest_info<class_PhysicsDirectSpaceState2D_method_get_rest_info>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary[]<class_Dictionary>` | :ref:`intersect_point<class_PhysicsDirectSpaceState2D_method_intersect_point>` **(** :ref:`PhysicsPointQueryParameters2D<class_PhysicsPointQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary<class_Dictionary>` | :ref:`intersect_ray<class_PhysicsDirectSpaceState2D_method_intersect_ray>` **(** :ref:`PhysicsRayQueryParameters2D<class_PhysicsRayQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary[]<class_Dictionary>` | :ref:`intersect_shape<class_PhysicsDirectSpaceState2D_method_intersect_shape>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`cast_motion<class_PhysicsDirectSpaceState2D_method_cast_motion>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedVector2Array[]<class_PackedVector2Array>` | :ref:`collide_shape<class_PhysicsDirectSpaceState2D_method_collide_shape>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary<class_Dictionary>` | :ref:`get_rest_info<class_PhysicsDirectSpaceState2D_method_get_rest_info>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary[]<class_Dictionary>` | :ref:`intersect_point<class_PhysicsDirectSpaceState2D_method_intersect_point>` **(** :ref:`PhysicsPointQueryParameters2D<class_PhysicsPointQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary<class_Dictionary>` | :ref:`intersect_ray<class_PhysicsDirectSpaceState2D_method_intersect_ray>` **(** :ref:`PhysicsRayQueryParameters2D<class_PhysicsRayQueryParameters2D>` parameters **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Dictionary[]<class_Dictionary>` | :ref:`intersect_shape<class_PhysicsDirectSpaceState2D_method_intersect_shape>` **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)** |
|
||||
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Method Descriptions
|
||||
-------------------
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_cast_motion:
|
||||
|
||||
- :ref:`PackedFloat32Array<class_PackedFloat32Array>` **cast_motion** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`PackedFloat32Array<class_PackedFloat32Array>` **cast_motion** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)**
|
||||
|
||||
Checks how far a :ref:`Shape2D<class_Shape2D>` can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through a :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` object.
|
||||
|
||||
@@ -58,21 +75,29 @@ Returns an array with the safe and unsafe proportions (between 0 and 1) of the m
|
||||
|
||||
\ **Note:** Any :ref:`Shape2D<class_Shape2D>`\ s that the shape is already colliding with e.g. inside of, will be ignored. Use :ref:`collide_shape<class_PhysicsDirectSpaceState2D_method_collide_shape>` to determine the :ref:`Shape2D<class_Shape2D>`\ s that the shape is already colliding with.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_collide_shape:
|
||||
|
||||
- :ref:`PackedVector2Array[]<class_PackedVector2Array>` **collide_shape** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`PackedVector2Array[]<class_PackedVector2Array>` **collide_shape** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
|
||||
Checks the intersections of a shape, given through a :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` object, against the space. The resulting array contains a list of points where the shape intersects another. Like with :ref:`intersect_shape<class_PhysicsDirectSpaceState2D_method_intersect_shape>`, the number of returned results can be limited to save processing time.
|
||||
|
||||
Returned points are a list of pairs of contact points. For each pair the first one is in the shape passed in :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` object, second one is in the collided shape from the physics space.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_get_rest_info:
|
||||
|
||||
- :ref:`Dictionary<class_Dictionary>` **get_rest_info** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Dictionary<class_Dictionary>` **get_rest_info** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters **)**
|
||||
|
||||
Checks the intersections of a shape, given through a :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead.
|
||||
|
||||
@@ -90,11 +115,15 @@ Checks the intersections of a shape, given through a :ref:`PhysicsShapeQueryPara
|
||||
|
||||
\ ``shape``: The shape index of the colliding shape.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_intersect_point:
|
||||
|
||||
- :ref:`Dictionary[]<class_Dictionary>` **intersect_point** **(** :ref:`PhysicsPointQueryParameters2D<class_PhysicsPointQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Dictionary[]<class_Dictionary>` **intersect_point** **(** :ref:`PhysicsPointQueryParameters2D<class_PhysicsPointQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
|
||||
Checks whether a point is inside any solid shape. Position and other parameters are defined through :ref:`PhysicsPointQueryParameters2D<class_PhysicsPointQueryParameters2D>`. The shapes the point is inside of are returned in an array containing dictionaries with the following fields:
|
||||
|
||||
@@ -110,11 +139,15 @@ The number of intersections can be limited with the ``max_results`` parameter, t
|
||||
|
||||
\ **Note:** :ref:`ConcavePolygonShape2D<class_ConcavePolygonShape2D>`\ s and :ref:`CollisionPolygon2D<class_CollisionPolygon2D>`\ s in ``Segments`` build mode are not solid shapes. Therefore, they will not be detected.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_intersect_ray:
|
||||
|
||||
- :ref:`Dictionary<class_Dictionary>` **intersect_ray** **(** :ref:`PhysicsRayQueryParameters2D<class_PhysicsRayQueryParameters2D>` parameters **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Dictionary<class_Dictionary>` **intersect_ray** **(** :ref:`PhysicsRayQueryParameters2D<class_PhysicsRayQueryParameters2D>` parameters **)**
|
||||
|
||||
Intersects a ray in a given space. Ray position and other parameters are defined through :ref:`PhysicsRayQueryParameters2D<class_PhysicsRayQueryParameters2D>`. The returned object is a dictionary with the following fields:
|
||||
|
||||
@@ -132,11 +165,15 @@ Intersects a ray in a given space. Ray position and other parameters are defined
|
||||
|
||||
If the ray did not intersect anything, then an empty dictionary is returned instead.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicsDirectSpaceState2D_method_intersect_shape:
|
||||
|
||||
- :ref:`Dictionary[]<class_Dictionary>` **intersect_shape** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Dictionary[]<class_Dictionary>` **intersect_shape** **(** :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` parameters, :ref:`int<class_int>` max_results=32 **)**
|
||||
|
||||
Checks the intersections of a shape, given through a :ref:`PhysicsShapeQueryParameters2D<class_PhysicsShapeQueryParameters2D>` object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user