: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/GLTFPhysicsShape.xml. .. _class_GLTFPhysicsShape: GLTFPhysicsShape ================ **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Represents a glTF physics shape. .. rst-class:: classref-introduction-group Description ----------- Represents a physics shape as defined by the ``OMI_physics_shape`` or ``OMI_collider`` glTF extensions. 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_shape glTF extension `__ - `OMI_collider glTF extension `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`float` | :ref:`height` | ``2.0`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`ImporterMesh` | :ref:`importer_mesh` | | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`bool` | :ref:`is_trigger` | ``false`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`int` | :ref:`mesh_index` | ``-1`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`float` | :ref:`radius` | ``0.5`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`String` | :ref:`shape_type` | ``""`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ | :ref:`Vector3` | :ref:`size` | ``Vector3(1, 1, 1)`` | +-----------------------------------------+---------------------------------------------------------------------+----------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`GLTFPhysicsShape` | :ref:`from_dictionary`\ (\ dictionary\: :ref:`Dictionary`\ ) |static| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`GLTFPhysicsShape` | :ref:`from_node`\ (\ shape_node\: :ref:`CollisionShape3D`\ ) |static| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`GLTFPhysicsShape` | :ref:`from_resource`\ (\ shape_resource\: :ref:`Shape3D`\ ) |static| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`to_dictionary`\ (\ ) |const| | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CollisionShape3D` | :ref:`to_node`\ (\ cache_shapes\: :ref:`bool` = false\ ) | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Shape3D` | :ref:`to_resource`\ (\ cache_shapes\: :ref:`bool` = false\ ) | +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_GLTFPhysicsShape_property_height: .. rst-class:: classref-property :ref:`float` **height** = ``2.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_height**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_height**\ (\ ) The height of the shape, in meters. This is only used when the shape type is ``"capsule"`` or ``"cylinder"``. This value should not be negative, and for ``"capsule"`` it should be at least twice the radius. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_importer_mesh: .. rst-class:: classref-property :ref:`ImporterMesh` **importer_mesh** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_importer_mesh**\ (\ value\: :ref:`ImporterMesh`\ ) - :ref:`ImporterMesh` **get_importer_mesh**\ (\ ) The :ref:`ImporterMesh` resource of the shape. This is only used when the shape type is ``"hull"`` (convex hull) or ``"trimesh"`` (concave trimesh). .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_is_trigger: .. rst-class:: classref-property :ref:`bool` **is_trigger** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_is_trigger**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **get_is_trigger**\ (\ ) If ``true``, indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an :ref:`Area3D` node. This is the only variable not used in the :ref:`to_node()` method, it's intended to be used alongside when deciding where to add the generated node as a child. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_mesh_index: .. rst-class:: classref-property :ref:`int` **mesh_index** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_mesh_index**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_mesh_index**\ (\ ) The index of the shape's mesh in the glTF file. This is only used when the shape type is ``"hull"`` (convex hull) or ``"trimesh"`` (concave trimesh). .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_radius: .. rst-class:: classref-property :ref:`float` **radius** = ``0.5`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_radius**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_radius**\ (\ ) The radius of the shape, in meters. This is only used when the shape type is ``"capsule"``, ``"cylinder"``, or ``"sphere"``. This value should not be negative. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_shape_type: .. rst-class:: classref-property :ref:`String` **shape_type** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_shape_type**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_shape_type**\ (\ ) The type of shape this shape represents. Valid values are ``"box"``, ``"capsule"``, ``"cylinder"``, ``"sphere"``, ``"hull"``, and ``"trimesh"``. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_property_size: .. rst-class:: classref-property :ref:`Vector3` **size** = ``Vector3(1, 1, 1)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_size**\ (\ value\: :ref:`Vector3`\ ) - :ref:`Vector3` **get_size**\ (\ ) The size of the shape, in meters. This is only used when the shape type is ``"box"``, and it represents the ``"diameter"`` of the box. This value should not be negative. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_GLTFPhysicsShape_method_from_dictionary: .. rst-class:: classref-method :ref:`GLTFPhysicsShape` **from_dictionary**\ (\ dictionary\: :ref:`Dictionary`\ ) |static| :ref:`🔗` Creates a new GLTFPhysicsShape instance by parsing the given :ref:`Dictionary`. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_method_from_node: .. rst-class:: classref-method :ref:`GLTFPhysicsShape` **from_node**\ (\ shape_node\: :ref:`CollisionShape3D`\ ) |static| :ref:`🔗` Creates a new GLTFPhysicsShape instance from the given Godot :ref:`CollisionShape3D` node. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_method_from_resource: .. rst-class:: classref-method :ref:`GLTFPhysicsShape` **from_resource**\ (\ shape_resource\: :ref:`Shape3D`\ ) |static| :ref:`🔗` Creates a new GLTFPhysicsShape instance from the given Godot :ref:`Shape3D` resource. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_method_to_dictionary: .. rst-class:: classref-method :ref:`Dictionary` **to_dictionary**\ (\ ) |const| :ref:`🔗` Serializes this GLTFPhysicsShape instance into a :ref:`Dictionary` in the format defined by ``OMI_physics_shape``. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_method_to_node: .. rst-class:: classref-method :ref:`CollisionShape3D` **to_node**\ (\ cache_shapes\: :ref:`bool` = false\ ) :ref:`🔗` Converts this GLTFPhysicsShape instance into a Godot :ref:`CollisionShape3D` node. .. rst-class:: classref-item-separator ---- .. _class_GLTFPhysicsShape_method_to_resource: .. rst-class:: classref-method :ref:`Shape3D` **to_resource**\ (\ cache_shapes\: :ref:`bool` = false\ ) :ref:`🔗` Converts this GLTFPhysicsShape instance into a Godot :ref:`Shape3D` resource. .. |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.)` .. |void| replace:: :abbr:`void (No return value.)`