class_meshinstance3d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/MeshInstance3D.xml.
  6. .. _class_MeshInstance3D:
  7. MeshInstance3D
  8. ==============
  9. **Inherits:** :ref:`GeometryInstance3D<class_GeometryInstance3D>` **<** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`SoftDynamicBody3D<class_SoftDynamicBody3D>`
  11. Node that instances meshes into a scenario.
  12. Description
  13. -----------
  14. MeshInstance3D is a node that takes a :ref:`Mesh<class_Mesh>` resource and adds it to the current scenario by creating an instance of it. This is the class most often used render 3D geometry and can be used to instance a single :ref:`Mesh<class_Mesh>` in many places. This allows reuse of geometry which can save on resources. When a :ref:`Mesh<class_Mesh>` has to be instantiated more than thousands of times at close proximity, consider using a :ref:`MultiMesh<class_MultiMesh>` in a :ref:`MultiMeshInstance3D<class_MultiMeshInstance3D>` instead.
  15. Tutorials
  16. ---------
  17. - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/123>`__
  18. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
  19. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
  20. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  21. Properties
  22. ----------
  23. +---------------------------------+---------------------------------------------------------+--------------------+
  24. | :ref:`Mesh<class_Mesh>` | :ref:`mesh<class_MeshInstance3D_property_mesh>` | |
  25. +---------------------------------+---------------------------------------------------------+--------------------+
  26. | :ref:`NodePath<class_NodePath>` | :ref:`skeleton<class_MeshInstance3D_property_skeleton>` | ``NodePath("..")`` |
  27. +---------------------------------+---------------------------------------------------------+--------------------+
  28. | :ref:`Skin<class_Skin>` | :ref:`skin<class_MeshInstance3D_property_skin>` | |
  29. +---------------------------------+---------------------------------------------------------+--------------------+
  30. Methods
  31. -------
  32. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`create_convex_collision<class_MeshInstance3D_method_create_convex_collision>` **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)** |
  34. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`create_debug_tangents<class_MeshInstance3D_method_create_debug_tangents>` **(** **)** |
  36. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`create_multiple_convex_collisions<class_MeshInstance3D_method_create_multiple_convex_collisions>` **(** **)** |
  38. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`create_trimesh_collision<class_MeshInstance3D_method_create_trimesh_collision>` **(** **)** |
  40. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`find_blend_shape_by_name<class_MeshInstance3D_method_find_blend_shape_by_name>` **(** :ref:`StringName<class_StringName>` name **)** |
  42. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Material<class_Material>` | :ref:`get_active_material<class_MeshInstance3D_method_get_active_material>` **(** :ref:`int<class_int>` surface **)** |const| |
  44. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`get_blend_shape_count<class_MeshInstance3D_method_get_blend_shape_count>` **(** **)** |const| |
  46. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`float<class_float>` | :ref:`get_blend_shape_value<class_MeshInstance3D_method_get_blend_shape_value>` **(** :ref:`int<class_int>` blend_shape_idx **)** |const| |
  48. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Material<class_Material>` | :ref:`get_surface_override_material<class_MeshInstance3D_method_get_surface_override_material>` **(** :ref:`int<class_int>` surface **)** |const| |
  50. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`int<class_int>` | :ref:`get_surface_override_material_count<class_MeshInstance3D_method_get_surface_override_material_count>` **(** **)** |const| |
  52. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`set_blend_shape_value<class_MeshInstance3D_method_set_blend_shape_value>` **(** :ref:`int<class_int>` blend_shape_idx, :ref:`float<class_float>` value **)** |
  54. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`set_surface_override_material<class_MeshInstance3D_method_set_surface_override_material>` **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)** |
  56. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. Property Descriptions
  58. ---------------------
  59. .. _class_MeshInstance3D_property_mesh:
  60. - :ref:`Mesh<class_Mesh>` **mesh**
  61. +----------+-----------------+
  62. | *Setter* | set_mesh(value) |
  63. +----------+-----------------+
  64. | *Getter* | get_mesh() |
  65. +----------+-----------------+
  66. The :ref:`Mesh<class_Mesh>` resource for the instance.
  67. ----
  68. .. _class_MeshInstance3D_property_skeleton:
  69. - :ref:`NodePath<class_NodePath>` **skeleton**
  70. +-----------+--------------------------+
  71. | *Default* | ``NodePath("..")`` |
  72. +-----------+--------------------------+
  73. | *Setter* | set_skeleton_path(value) |
  74. +-----------+--------------------------+
  75. | *Getter* | get_skeleton_path() |
  76. +-----------+--------------------------+
  77. :ref:`NodePath<class_NodePath>` to the :ref:`Skeleton3D<class_Skeleton3D>` associated with the instance.
  78. ----
  79. .. _class_MeshInstance3D_property_skin:
  80. - :ref:`Skin<class_Skin>` **skin**
  81. +----------+-----------------+
  82. | *Setter* | set_skin(value) |
  83. +----------+-----------------+
  84. | *Getter* | get_skin() |
  85. +----------+-----------------+
  86. Sets the skin to be used by this instance.
  87. Method Descriptions
  88. -------------------
  89. .. _class_MeshInstance3D_method_create_convex_collision:
  90. - void **create_convex_collision** **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)**
  91. This helper creates a :ref:`StaticBody3D<class_StaticBody3D>` child node with a :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` collision shape calculated from the mesh geometry. It's mainly used for testing.
  92. If ``clean`` is ``true`` (default), duplicate and interior vertices are removed automatically. You can set it to ``false`` to make the process faster if not needed.
  93. If ``simplify`` is ``true``, the geometry can be further simplified to reduce the amount of vertices. Disabled by default.
  94. ----
  95. .. _class_MeshInstance3D_method_create_debug_tangents:
  96. - void **create_debug_tangents** **(** **)**
  97. This helper creates a ``MeshInstance3D`` child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing.
  98. ----
  99. .. _class_MeshInstance3D_method_create_multiple_convex_collisions:
  100. - void **create_multiple_convex_collisions** **(** **)**
  101. This helper creates a :ref:`StaticBody3D<class_StaticBody3D>` child node with multiple :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` collision shapes calculated from the mesh geometry via convex decomposition. It's mainly used for testing.
  102. ----
  103. .. _class_MeshInstance3D_method_create_trimesh_collision:
  104. - void **create_trimesh_collision** **(** **)**
  105. This helper creates a :ref:`StaticBody3D<class_StaticBody3D>` child node with a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` collision shape calculated from the mesh geometry. It's mainly used for testing.
  106. ----
  107. .. _class_MeshInstance3D_method_find_blend_shape_by_name:
  108. - :ref:`int<class_int>` **find_blend_shape_by_name** **(** :ref:`StringName<class_StringName>` name **)**
  109. ----
  110. .. _class_MeshInstance3D_method_get_active_material:
  111. - :ref:`Material<class_Material>` **get_active_material** **(** :ref:`int<class_int>` surface **)** |const|
  112. Returns the :ref:`Material<class_Material>` that will be used by the :ref:`Mesh<class_Mesh>` when drawing. This can return the :ref:`GeometryInstance3D.material_override<class_GeometryInstance3D_property_material_override>`, the surface override :ref:`Material<class_Material>` defined in this ``MeshInstance3D``, or the surface :ref:`Material<class_Material>` defined in the :ref:`Mesh<class_Mesh>`. For example, if :ref:`GeometryInstance3D.material_override<class_GeometryInstance3D_property_material_override>` is used, all surfaces will return the override material.
  113. ----
  114. .. _class_MeshInstance3D_method_get_blend_shape_count:
  115. - :ref:`int<class_int>` **get_blend_shape_count** **(** **)** |const|
  116. ----
  117. .. _class_MeshInstance3D_method_get_blend_shape_value:
  118. - :ref:`float<class_float>` **get_blend_shape_value** **(** :ref:`int<class_int>` blend_shape_idx **)** |const|
  119. ----
  120. .. _class_MeshInstance3D_method_get_surface_override_material:
  121. - :ref:`Material<class_Material>` **get_surface_override_material** **(** :ref:`int<class_int>` surface **)** |const|
  122. Returns the override :ref:`Material<class_Material>` for the specified surface of the :ref:`Mesh<class_Mesh>` resource.
  123. ----
  124. .. _class_MeshInstance3D_method_get_surface_override_material_count:
  125. - :ref:`int<class_int>` **get_surface_override_material_count** **(** **)** |const|
  126. Returns the number of surface override materials. This is equivalent to :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>`.
  127. ----
  128. .. _class_MeshInstance3D_method_set_blend_shape_value:
  129. - void **set_blend_shape_value** **(** :ref:`int<class_int>` blend_shape_idx, :ref:`float<class_float>` value **)**
  130. ----
  131. .. _class_MeshInstance3D_method_set_surface_override_material:
  132. - void **set_surface_override_material** **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)**
  133. Sets the override :ref:`Material<class_Material>` for the specified surface of the :ref:`Mesh<class_Mesh>` resource. This material is associated with this ``MeshInstance3D`` rather than with the :ref:`Mesh<class_Mesh>` resource.
  134. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  135. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  136. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  137. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  138. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  139. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`