mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
242 lines
10 KiB
ReStructuredText
242 lines
10 KiB
ReStructuredText
: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/modules/gltf/doc_classes/GLTFPhysicsBody.xml.
|
|
|
|
.. _class_GLTFPhysicsBody:
|
|
|
|
GLTFPhysicsBody
|
|
===============
|
|
|
|
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Represents a GLTF physics body.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
Represents a physics body as defined by the ``OMI_physics_body`` GLTF extension. This class is an intermediary between the GLTF data and Godot's nodes, and it's abstracted in a way that allows adding support for different GLTF physics extensions in the future.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
|
|
|
|
- `OMI_physics_body GLTF extension <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_physics_body>`__
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`angular_velocity<class_GLTFPhysicsBody_property_angular_velocity>` | ``Vector3(0, 0, 0)`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`body_type<class_GLTFPhysicsBody_property_body_type>` | ``"static"`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`center_of_mass<class_GLTFPhysicsBody_property_center_of_mass>` | ``Vector3(0, 0, 0)`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Basis<class_Basis>` | :ref:`inertia_tensor<class_GLTFPhysicsBody_property_inertia_tensor>` | ``Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`linear_velocity<class_GLTFPhysicsBody_property_linear_velocity>` | ``Vector3(0, 0, 0)`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`mass<class_GLTFPhysicsBody_property_mass>` | ``1.0`` |
|
|
+-------------------------------+--------------------------------------------------------------------------+--------------------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_dictionary<class_GLTFPhysicsBody_method_from_dictionary>` **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static| |
|
|
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_node<class_GLTFPhysicsBody_method_from_node>` **(** :ref:`CollisionObject3D<class_CollisionObject3D>` body_node **)** |static| |
|
|
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFPhysicsBody_method_to_dictionary>` **(** **)** |const| |
|
|
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`CollisionObject3D<class_CollisionObject3D>` | :ref:`to_node<class_GLTFPhysicsBody_method_to_node>` **(** **)** |const| |
|
|
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_GLTFPhysicsBody_property_angular_velocity:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **angular_velocity** = ``Vector3(0, 0, 0)``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_angular_velocity** **(** :ref:`Vector3<class_Vector3>` value **)**
|
|
- :ref:`Vector3<class_Vector3>` **get_angular_velocity** **(** **)**
|
|
|
|
The angular velocity of the physics body, in radians per second. This is only used when the body type is "rigid" or "vehicle".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_body_type:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **body_type** = ``"static"``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_body_type** **(** :ref:`String<class_String>` value **)**
|
|
- :ref:`String<class_String>` **get_body_type** **(** **)**
|
|
|
|
The type of the body. When importing, this controls what type of :ref:`CollisionObject3D<class_CollisionObject3D>` node Godot should generate. Valid values are "static", "kinematic", "character", "rigid", "vehicle", and "trigger".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_center_of_mass:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **center_of_mass** = ``Vector3(0, 0, 0)``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_center_of_mass** **(** :ref:`Vector3<class_Vector3>` value **)**
|
|
- :ref:`Vector3<class_Vector3>` **get_center_of_mass** **(** **)**
|
|
|
|
The center of mass of the body, in meters. This is in local space relative to the body. By default, the center of the mass is the body's origin.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_inertia_tensor:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Basis<class_Basis>` **inertia_tensor** = ``Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_inertia_tensor** **(** :ref:`Basis<class_Basis>` value **)**
|
|
- :ref:`Basis<class_Basis>` **get_inertia_tensor** **(** **)**
|
|
|
|
The inertia tensor of the physics body, in kilogram meter squared (kg⋅m²). This is only used when the body type is "rigid" or "vehicle".
|
|
|
|
When converted to a Godot :ref:`RigidBody3D<class_RigidBody3D>` node, if this value is zero, then the inertia will be calculated automatically.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_linear_velocity:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **linear_velocity** = ``Vector3(0, 0, 0)``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_linear_velocity** **(** :ref:`Vector3<class_Vector3>` value **)**
|
|
- :ref:`Vector3<class_Vector3>` **get_linear_velocity** **(** **)**
|
|
|
|
The linear velocity of the physics body, in meters per second. This is only used when the body type is "rigid" or "vehicle".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_mass:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **mass** = ``1.0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_mass** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_mass** **(** **)**
|
|
|
|
The mass of the physics body, in kilograms. This is only used when the body type is "rigid" or "vehicle".
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_GLTFPhysicsBody_method_from_dictionary:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_dictionary** **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static|
|
|
|
|
Creates a new GLTFPhysicsBody instance by parsing the given :ref:`Dictionary<class_Dictionary>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_from_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_node** **(** :ref:`CollisionObject3D<class_CollisionObject3D>` body_node **)** |static|
|
|
|
|
Create a new GLTFPhysicsBody instance from the given Godot :ref:`CollisionObject3D<class_CollisionObject3D>` node.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_to_dictionary:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Dictionary<class_Dictionary>` **to_dictionary** **(** **)** |const|
|
|
|
|
Serializes this GLTFPhysicsBody instance into a :ref:`Dictionary<class_Dictionary>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_to_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`CollisionObject3D<class_CollisionObject3D>` **to_node** **(** **)** |const|
|
|
|
|
Converts this GLTFPhysicsBody instance into a Godot :ref:`CollisionObject3D<class_CollisionObject3D>` node.
|
|
|
|
.. |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.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|