mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
285 lines
14 KiB
ReStructuredText
285 lines
14 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_GLTFPhysicsBody:
|
|
|
|
GLTFPhysicsBody
|
|
===============
|
|
|
|
**Eredita:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Rappresenta un corpo fisico glTF.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descrizione
|
|
----------------------
|
|
|
|
Rappresenta un corpo fisico come intermediario tra i dati glTF ``OMI_physics_body`` e i nodi di Godot, ed è astratto in modo da supportare in futuro diverse estensioni glTF di fisica.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorial
|
|
----------------
|
|
|
|
- :doc:`Caricamento e salvataggio di file a tempo di esecuzione <../tutorials/io/runtime_file_loading_and_saving>`
|
|
|
|
- `Estensione glTF OMI_physics_body <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_physics_body>`__
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Proprietà
|
|
------------------
|
|
|
|
.. 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>` | ``"rigid"`` |
|
|
+-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`center_of_mass<class_GLTFPhysicsBody_property_center_of_mass>` | ``Vector3(0, 0, 0)`` |
|
|
+-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`inertia_diagonal<class_GLTFPhysicsBody_property_inertia_diagonal>` | ``Vector3(0, 0, 0)`` |
|
|
+-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
|
|
| :ref:`Quaternion<class_Quaternion>` | :ref:`inertia_orientation<class_GLTFPhysicsBody_property_inertia_orientation>` | ``Quaternion(0, 0, 0, 1)`` |
|
|
+-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
|
|
| :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
|
|
|
|
Metodi
|
|
------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_dictionary<class_GLTFPhysicsBody_method_from_dictionary>`\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_node<class_GLTFPhysicsBody_method_from_node>`\ (\ body_node\: :ref:`CollisionObject3D<class_CollisionObject3D>`\ ) |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
|
|
|
|
Descrizioni delle proprietà
|
|
------------------------------------------------------
|
|
|
|
.. _class_GLTFPhysicsBody_property_angular_velocity:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **angular_velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_angular_velocity>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_angular_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_angular_velocity**\ (\ )
|
|
|
|
La velocità angolare del corpo fisico, in radianti al secondo. È utilizzata solo quando il tipo di corpo è "rigid" o "vehicle".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_body_type:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **body_type** = ``"rigid"`` :ref:`🔗<class_GLTFPhysicsBody_property_body_type>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_body_type**\ (\ value\: :ref:`String<class_String>`\ )
|
|
- :ref:`String<class_String>` **get_body_type**\ (\ )
|
|
|
|
Il tipo del corpo.
|
|
|
|
All'importazione, questo controlla il tipo di nodo :ref:`CollisionObject3D<class_CollisionObject3D>` che Godot deve generare. I valori validi sono ``"static"``, ``"animatable"``, ``"character"``, ``"rigid"``, ``"vehicle"`` e ``"trigger"``.
|
|
|
|
All'esportazione, questo sarà ridotto in uno dei tipi di movimento ``"static"``, ``"kinematic"`` o ``"dynamic"`` oppure nella proprietà ``"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)`` :ref:`🔗<class_GLTFPhysicsBody_property_center_of_mass>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_center_of_mass**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_center_of_mass**\ (\ )
|
|
|
|
Il centro di massa del corpo, in metri. Questo è nello spazio locale relativo al corpo. Per impostazione predefinita, il centro di massa è l'origine del corpo.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_inertia_diagonal:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **inertia_diagonal** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_diagonal>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_inertia_diagonal**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_inertia_diagonal**\ (\ )
|
|
|
|
La forza di inerzia del corpo fisico, in chilogrammi per metro quadrato (kg⋅m²). Rappresenta l'inerzia attorno agli assi principali, la diagonale della matrice tensore di inerzia. È utilizzata solo quando il tipo di corpo è "rigid" o "vehicle".
|
|
|
|
Quando convertito in un nodo :ref:`RigidBody3D<class_RigidBody3D>` di Godot, se questo valore è zero, l'inerzia sarà calcolata automaticamente.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_inertia_orientation:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Quaternion<class_Quaternion>` **inertia_orientation** = ``Quaternion(0, 0, 0, 1)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_orientation>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_inertia_orientation**\ (\ value\: :ref:`Quaternion<class_Quaternion>`\ )
|
|
- :ref:`Quaternion<class_Quaternion>` **get_inertia_orientation**\ (\ )
|
|
|
|
L'orientamento dell'inerzia del corpo fisico. Definisce la rotazione degli assi principali dell'inerzia rispetto agli assi locali dell'oggetto. È utilizzato solo quando il tipo di corpo è "rigid" o "vehicle" e :ref:`inertia_diagonal<class_GLTFPhysicsBody_property_inertia_diagonal>` è impostato su un valore diverso da zero.
|
|
|
|
.. 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)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_tensor>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_inertia_tensor**\ (\ value\: :ref:`Basis<class_Basis>`\ )
|
|
- :ref:`Basis<class_Basis>` **get_inertia_tensor**\ (\ )
|
|
|
|
**Deprecato:** Questa proprietà potrebbe essere cambiata o rimossa in versioni future.
|
|
|
|
Il tensore di inerzia del corpo fisico, in chilogrammi metro quadrato (kg⋅m²). È utilizzato solo quando il tipo di corpo è "rigid" o "vehicle".
|
|
|
|
Quando convertito in un nodo :ref:`RigidBody3D<class_RigidBody3D>` di Godot, se questo valore è zero, l'inerzia sarà calcolata automaticamente.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_linear_velocity:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **linear_velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_linear_velocity>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_linear_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_linear_velocity**\ (\ )
|
|
|
|
La velocità lineare del corpo fisico, in metri al secondo. È utilizzata solo quando il tipo di corpo è "rigid" o "vehicle".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_property_mass:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **mass** = ``1.0`` :ref:`🔗<class_GLTFPhysicsBody_property_mass>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_mass**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_mass**\ (\ )
|
|
|
|
La massa del corpo fisico, chilogrammi. È utilizzata solo quando il tipo di corpo è "rigid" o "vehicle".
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni dei metodi
|
|
--------------------------------------------
|
|
|
|
.. _class_GLTFPhysicsBody_method_from_dictionary:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_dictionary**\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| :ref:`🔗<class_GLTFPhysicsBody_method_from_dictionary>`
|
|
|
|
Crea una nuova istanza di GLTFPhysicsBody elaborando il :ref:`Dictionary<class_Dictionary>` specificato nel formato di estensione glTF ``OMI_physics_body``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_from_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_node**\ (\ body_node\: :ref:`CollisionObject3D<class_CollisionObject3D>`\ ) |static| :ref:`🔗<class_GLTFPhysicsBody_method_from_node>`
|
|
|
|
Crea una nuova istanza di GLTFPhysicsBody dal nodo :ref:`CollisionObject3D<class_CollisionObject3D>` di Godot specificato.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_to_dictionary:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Dictionary<class_Dictionary>` **to_dictionary**\ (\ ) |const| :ref:`🔗<class_GLTFPhysicsBody_method_to_dictionary>`
|
|
|
|
Serializza questa istanza di GLTFPhysicsBody in un :ref:`Dictionary<class_Dictionary>`. Sarà nel formato previsto dall'estensione glTF ``OMI_physics_body``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFPhysicsBody_method_to_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`CollisionObject3D<class_CollisionObject3D>` **to_node**\ (\ ) |const| :ref:`🔗<class_GLTFPhysicsBody_method_to_node>`
|
|
|
|
Converte questa istanza GLTFPhysicsBody in un nodo :ref:`CollisionObject3D<class_CollisionObject3D>` di Godot.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
|
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
|
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|