class_meshinstance.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the MeshInstance.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_MeshInstance:
  6. MeshInstance
  7. ============
  8. **Inherits:** :ref:`GeometryInstance<class_GeometryInstance>` **<** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`SoftBody<class_SoftBody>`
  10. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Node that instances meshes into a scenario.
  14. Properties
  15. ----------
  16. +---------------------------------+-------------------------------------------------------+
  17. | :ref:`Mesh<class_Mesh>` | :ref:`mesh<class_MeshInstance_property_mesh>` |
  18. +---------------------------------+-------------------------------------------------------+
  19. | :ref:`NodePath<class_NodePath>` | :ref:`skeleton<class_MeshInstance_property_skeleton>` |
  20. +---------------------------------+-------------------------------------------------------+
  21. Methods
  22. -------
  23. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`create_convex_collision<class_MeshInstance_method_create_convex_collision>` **(** **)** |
  25. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`create_debug_tangents<class_MeshInstance_method_create_debug_tangents>` **(** **)** |
  27. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`create_trimesh_collision<class_MeshInstance_method_create_trimesh_collision>` **(** **)** |
  29. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Material<class_Material>` | :ref:`get_surface_material<class_MeshInstance_method_get_surface_material>` **(** :ref:`int<class_int>` surface **)** const |
  31. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_surface_material_count<class_MeshInstance_method_get_surface_material_count>` **(** **)** const |
  33. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_surface_material<class_MeshInstance_method_set_surface_material>` **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)** |
  35. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. Description
  37. -----------
  38. MeshInstance 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 to get 3D geometry rendered and can be used to instance a single :ref:`Mesh<class_Mesh>` in many places. This allows to reuse geometry and save on resources. When a :ref:`Mesh<class_Mesh>` has to be instanced more than thousands of times at close proximity, consider using a :ref:`MultiMesh<class_MultiMesh>` in a :ref:`MultiMeshInstance<class_MultiMeshInstance>` instead.
  39. Property Descriptions
  40. ---------------------
  41. .. _class_MeshInstance_property_mesh:
  42. - :ref:`Mesh<class_Mesh>` **mesh**
  43. +----------+-----------------+
  44. | *Setter* | set_mesh(value) |
  45. +----------+-----------------+
  46. | *Getter* | get_mesh() |
  47. +----------+-----------------+
  48. The :ref:`Mesh<class_Mesh>` resource for the instance.
  49. ----
  50. .. _class_MeshInstance_property_skeleton:
  51. - :ref:`NodePath<class_NodePath>` **skeleton**
  52. +----------+--------------------------+
  53. | *Setter* | set_skeleton_path(value) |
  54. +----------+--------------------------+
  55. | *Getter* | get_skeleton_path() |
  56. +----------+--------------------------+
  57. :ref:`NodePath<class_NodePath>` to the :ref:`Skeleton<class_Skeleton>` associated with the instance.
  58. Method Descriptions
  59. -------------------
  60. .. _class_MeshInstance_method_create_convex_collision:
  61. - void **create_convex_collision** **(** **)**
  62. This helper creates a :ref:`StaticBody<class_StaticBody>` child node with a :ref:`ConvexPolygonShape<class_ConvexPolygonShape>` collision shape calculated from the mesh geometry. It's mainly used for testing.
  63. ----
  64. .. _class_MeshInstance_method_create_debug_tangents:
  65. - void **create_debug_tangents** **(** **)**
  66. This helper creates a :ref:`MeshInstance<class_MeshInstance>` child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing.
  67. ----
  68. .. _class_MeshInstance_method_create_trimesh_collision:
  69. - void **create_trimesh_collision** **(** **)**
  70. This helper creates a :ref:`StaticBody<class_StaticBody>` child node with a :ref:`ConcavePolygonShape<class_ConcavePolygonShape>` collision shape calculated from the mesh geometry. It's mainly used for testing.
  71. ----
  72. .. _class_MeshInstance_method_get_surface_material:
  73. - :ref:`Material<class_Material>` **get_surface_material** **(** :ref:`int<class_int>` surface **)** const
  74. Returns the :ref:`Material<class_Material>` for a surface of the :ref:`Mesh<class_Mesh>` resource.
  75. ----
  76. .. _class_MeshInstance_method_get_surface_material_count:
  77. - :ref:`int<class_int>` **get_surface_material_count** **(** **)** const
  78. Returns the number of surface materials.
  79. ----
  80. .. _class_MeshInstance_method_set_surface_material:
  81. - void **set_surface_material** **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)**
  82. Sets the :ref:`Material<class_Material>` for a surface of the :ref:`Mesh<class_Mesh>` resource.