GLTFPhysicsShape.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="GLTFPhysicsShape" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
  3. <brief_description>
  4. Represents a glTF physics shape.
  5. </brief_description>
  6. <description>
  7. Represents a physics shape as defined by the [code]OMI_physics_shape[/code] or [code]OMI_collider[/code] 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.
  8. </description>
  9. <tutorials>
  10. <link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
  11. <link title="OMI_physics_shape glTF extension">https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_physics_shape</link>
  12. <link title="OMI_collider glTF extension">https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/Archived/OMI_collider</link>
  13. </tutorials>
  14. <methods>
  15. <method name="from_dictionary" qualifiers="static">
  16. <return type="GLTFPhysicsShape" />
  17. <param index="0" name="dictionary" type="Dictionary" />
  18. <description>
  19. Creates a new GLTFPhysicsShape instance by parsing the given [Dictionary].
  20. </description>
  21. </method>
  22. <method name="from_node" qualifiers="static">
  23. <return type="GLTFPhysicsShape" />
  24. <param index="0" name="shape_node" type="CollisionShape3D" />
  25. <description>
  26. Creates a new GLTFPhysicsShape instance from the given Godot [CollisionShape3D] node.
  27. </description>
  28. </method>
  29. <method name="from_resource" qualifiers="static">
  30. <return type="GLTFPhysicsShape" />
  31. <param index="0" name="shape_resource" type="Shape3D" />
  32. <description>
  33. Creates a new GLTFPhysicsShape instance from the given Godot [Shape3D] resource.
  34. </description>
  35. </method>
  36. <method name="to_dictionary" qualifiers="const">
  37. <return type="Dictionary" />
  38. <description>
  39. Serializes this GLTFPhysicsShape instance into a [Dictionary] in the format defined by [code]OMI_physics_shape[/code].
  40. </description>
  41. </method>
  42. <method name="to_node">
  43. <return type="CollisionShape3D" />
  44. <param index="0" name="cache_shapes" type="bool" default="false" />
  45. <description>
  46. Converts this GLTFPhysicsShape instance into a Godot [CollisionShape3D] node.
  47. </description>
  48. </method>
  49. <method name="to_resource">
  50. <return type="Shape3D" />
  51. <param index="0" name="cache_shapes" type="bool" default="false" />
  52. <description>
  53. Converts this GLTFPhysicsShape instance into a Godot [Shape3D] resource.
  54. </description>
  55. </method>
  56. </methods>
  57. <members>
  58. <member name="height" type="float" setter="set_height" getter="get_height" default="2.0">
  59. The height of the shape, in meters. This is only used when the shape type is [code]"capsule"[/code] or [code]"cylinder"[/code]. This value should not be negative, and for [code]"capsule"[/code] it should be at least twice the radius.
  60. </member>
  61. <member name="importer_mesh" type="ImporterMesh" setter="set_importer_mesh" getter="get_importer_mesh">
  62. The [ImporterMesh] resource of the shape. This is only used when the shape type is [code]"hull"[/code] (convex hull) or [code]"trimesh"[/code] (concave trimesh).
  63. </member>
  64. <member name="is_trigger" type="bool" setter="set_is_trigger" getter="get_is_trigger" default="false">
  65. If [code]true[/code], indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an [Area3D] node.
  66. This is the only variable not used in the [method to_node] method, it's intended to be used alongside when deciding where to add the generated node as a child.
  67. </member>
  68. <member name="mesh_index" type="int" setter="set_mesh_index" getter="get_mesh_index" default="-1">
  69. The index of the shape's mesh in the glTF file. This is only used when the shape type is [code]"hull"[/code] (convex hull) or [code]"trimesh"[/code] (concave trimesh).
  70. </member>
  71. <member name="radius" type="float" setter="set_radius" getter="get_radius" default="0.5">
  72. The radius of the shape, in meters. This is only used when the shape type is [code]"capsule"[/code], [code]"cylinder"[/code], or [code]"sphere"[/code]. This value should not be negative.
  73. </member>
  74. <member name="shape_type" type="String" setter="set_shape_type" getter="get_shape_type" default="&quot;&quot;">
  75. The type of shape this shape represents. Valid values are [code]"box"[/code], [code]"capsule"[/code], [code]"cylinder"[/code], [code]"sphere"[/code], [code]"hull"[/code], and [code]"trimesh"[/code].
  76. </member>
  77. <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(1, 1, 1)">
  78. The size of the shape, in meters. This is only used when the shape type is [code]"box"[/code], and it represents the [code]"diameter"[/code] of the box. This value should not be negative.
  79. </member>
  80. </members>
  81. </class>