Files
godot-docs-l10n/classes/zh_CN/class_physicsshapequeryparameters3d.rst

254 lines
12 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/PhysicsShapeQueryParameters3D.xml.
.. _class_PhysicsShapeQueryParameters3D:
PhysicsShapeQueryParameters3D
=============================
**继承:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
:ref:`PhysicsDirectSpaceState3D<class_PhysicsDirectSpaceState3D>` 的方法提供参数。
.. rst-class:: classref-introduction-group
描述
----
可以通过修改这个对象的形状等属性来为 :ref:`PhysicsDirectSpaceState3D<class_PhysicsDirectSpaceState3D>` 的方法配置参数。
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`collide_with_areas<class_PhysicsShapeQueryParameters3D_property_collide_with_areas>` | ``false`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`collide_with_bodies<class_PhysicsShapeQueryParameters3D_property_collide_with_bodies>` | ``true`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`collision_mask<class_PhysicsShapeQueryParameters3D_property_collision_mask>` | ``4294967295`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\] | :ref:`exclude<class_PhysicsShapeQueryParameters3D_property_exclude>` | ``[]`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`float<class_float>` | :ref:`margin<class_PhysicsShapeQueryParameters3D_property_margin>` | ``0.0`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`motion<class_PhysicsShapeQueryParameters3D_property_motion>` | ``Vector3(0, 0, 0)`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`Resource<class_Resource>` | :ref:`shape<class_PhysicsShapeQueryParameters3D_property_shape>` | |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`shape_rid<class_PhysicsShapeQueryParameters3D_property_shape_rid>` | ``RID()`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`transform<class_PhysicsShapeQueryParameters3D_property_transform>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
+----------------------------------------------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_PhysicsShapeQueryParameters3D_property_collide_with_areas:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **collide_with_areas** = ``false`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_collide_with_areas>`
.. rst-class:: classref-property-setget
- |void| **set_collide_with_areas**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_collide_with_areas_enabled**\ (\ )
如果为 ``true``\ ,则查询将考虑 :ref:`Area3D<class_Area3D>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_collide_with_bodies:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **collide_with_bodies** = ``true`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_collide_with_bodies>`
.. rst-class:: classref-property-setget
- |void| **set_collide_with_bodies**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_collide_with_bodies_enabled**\ (\ )
如果为 ``true``\ ,则查询将考虑 :ref:`PhysicsBody3D<class_PhysicsBody3D>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_collision_mask:
.. rst-class:: classref-property
:ref:`int<class_int>` **collision_mask** = ``4294967295`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_collision_mask>`
.. rst-class:: classref-property-setget
- |void| **set_collision_mask**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_collision_mask**\ (\ )
查询将检测的物理层(作为位掩码)。默认情况下,会检测所有碰撞层。有关详细信息,请参阅文档中的 `《碰撞层和掩码》 <../tutorials/physics/physics_introduction.html#collision-layers-and-masks>`__\ 。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_exclude:
.. rst-class:: classref-property
:ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\] **exclude** = ``[]`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_exclude>`
.. rst-class:: classref-property-setget
- |void| **set_exclude**\ (\ value\: :ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\]\ )
- :ref:`Array<class_Array>`\[:ref:`RID<class_RID>`\] **get_exclude**\ (\ )
将被排除在碰撞之外的对象的 :ref:`RID<class_RID>` 列表。请使用 :ref:`CollisionObject3D.get_rid()<class_CollisionObject3D_method_get_rid>` 来获取与派生自 :ref:`CollisionObject3D<class_CollisionObject3D>` 的节点关联的 :ref:`RID<class_RID>`\ 。
\ **注意:**\ 返回的数组为副本,对其进行的修改不会更新原有属性。更新时,请先修改返回的数组,然后将其重新赋值回该属性。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_margin:
.. rst-class:: classref-property
:ref:`float<class_float>` **margin** = ``0.0`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_margin>`
.. rst-class:: classref-property-setget
- |void| **set_margin**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_margin**\ (\ )
形状的碰撞边距。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_motion:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **motion** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_motion>`
.. rst-class:: classref-property-setget
- |void| **set_motion**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
- :ref:`Vector3<class_Vector3>` **get_motion**\ (\ )
正在查询的形状的运动。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_shape:
.. rst-class:: classref-property
:ref:`Resource<class_Resource>` **shape** :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_shape>`
.. rst-class:: classref-property-setget
- |void| **set_shape**\ (\ value\: :ref:`Resource<class_Resource>`\ )
- :ref:`Resource<class_Resource>` **get_shape**\ (\ )
将用于碰撞/相交查询的 :ref:`Shape3D<class_Shape3D>`\ 。存储的是实际的引用,可以避免该形状在进行查询时被释放,因此请优先使用这个属性,而不是 :ref:`shape_rid<class_PhysicsShapeQueryParameters3D_property_shape_rid>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_shape_rid:
.. rst-class:: classref-property
:ref:`RID<class_RID>` **shape_rid** = ``RID()`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_shape_rid>`
.. rst-class:: classref-property-setget
- |void| **set_shape_rid**\ (\ value\: :ref:`RID<class_RID>`\ )
- :ref:`RID<class_RID>` **get_shape_rid**\ (\ )
将用于碰撞/相交查询的形状的 :ref:`RID<class_RID>`\ 。如果你想要使用服务器 API 优化性能,请使用这个属性而不是 :ref:`shape<class_PhysicsShapeQueryParameters3D_property_shape>`\
.. tabs::
.. code-tab:: gdscript
var shape_rid = PhysicsServer3D.sphere_shape_create()
var radius = 2.0
PhysicsServer3D.shape_set_data(shape_rid, radius)
var params = PhysicsShapeQueryParameters3D.new()
params.shape_rid = shape_rid
# 在此处执行物理查询...
# 完成物理查询后释放形状。
PhysicsServer3D.free_rid(shape_rid)
.. code-tab:: csharp
RID shapeRid = PhysicsServer3D.SphereShapeCreate();
float radius = 2.0f;
PhysicsServer3D.ShapeSetData(shapeRid, radius);
var params = new PhysicsShapeQueryParameters3D();
params.ShapeRid = shapeRid;
// 在此处执行物理查询...
// 完成物理查询后释放形状。
PhysicsServer3D.FreeRid(shapeRid);
.. rst-class:: classref-item-separator
----
.. _class_PhysicsShapeQueryParameters3D_property_transform:
.. rst-class:: classref-property
:ref:`Transform3D<class_Transform3D>` **transform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗<class_PhysicsShapeQueryParameters3D_property_transform>`
.. rst-class:: classref-property-setget
- |void| **set_transform**\ (\ value\: :ref:`Transform3D<class_Transform3D>`\ )
- :ref:`Transform3D<class_Transform3D>` **get_transform**\ (\ )
被查询形状的变换矩阵。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`