class_meshinstance.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the MeshInstance.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_MeshInstance:
  5. MeshInstance
  6. ============
  7. **Inherits:** :ref:`GeometryInstance<class_GeometryInstance>` **<** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`SoftBody<class_SoftBody>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Node that instances meshes into a scenario.
  13. Properties
  14. ----------
  15. +---------------------------------+----------------------------------------------+
  16. | :ref:`Mesh<class_Mesh>` | :ref:`mesh<class_MeshInstance_mesh>` |
  17. +---------------------------------+----------------------------------------------+
  18. | :ref:`NodePath<class_NodePath>` | :ref:`skeleton<class_MeshInstance_skeleton>` |
  19. +---------------------------------+----------------------------------------------+
  20. Methods
  21. -------
  22. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`create_convex_collision<class_MeshInstance_create_convex_collision>` **(** **)** |
  24. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`create_debug_tangents<class_MeshInstance_create_debug_tangents>` **(** **)** |
  26. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`create_trimesh_collision<class_MeshInstance_create_trimesh_collision>` **(** **)** |
  28. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Material<class_Material>` | :ref:`get_surface_material<class_MeshInstance_get_surface_material>` **(** :ref:`int<class_int>` surface **)** const |
  30. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_surface_material_count<class_MeshInstance_get_surface_material_count>` **(** **)** const |
  32. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_surface_material<class_MeshInstance_set_surface_material>` **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)** |
  34. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. Description
  36. -----------
  37. 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.
  38. Property Descriptions
  39. ---------------------
  40. .. _class_MeshInstance_mesh:
  41. - :ref:`Mesh<class_Mesh>` **mesh**
  42. +----------+-----------------+
  43. | *Setter* | set_mesh(value) |
  44. +----------+-----------------+
  45. | *Getter* | get_mesh() |
  46. +----------+-----------------+
  47. The :ref:`Mesh<class_Mesh>` resource for the instance.
  48. .. _class_MeshInstance_skeleton:
  49. - :ref:`NodePath<class_NodePath>` **skeleton**
  50. +----------+--------------------------+
  51. | *Setter* | set_skeleton_path(value) |
  52. +----------+--------------------------+
  53. | *Getter* | get_skeleton_path() |
  54. +----------+--------------------------+
  55. :ref:`NodePath<class_NodePath>` to the :ref:`Skeleton<class_Skeleton>` associated with the instance.
  56. Method Descriptions
  57. -------------------
  58. .. _class_MeshInstance_create_convex_collision:
  59. - void **create_convex_collision** **(** **)**
  60. 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.
  61. .. _class_MeshInstance_create_debug_tangents:
  62. - void **create_debug_tangents** **(** **)**
  63. 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.
  64. .. _class_MeshInstance_create_trimesh_collision:
  65. - void **create_trimesh_collision** **(** **)**
  66. 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.
  67. .. _class_MeshInstance_get_surface_material:
  68. - :ref:`Material<class_Material>` **get_surface_material** **(** :ref:`int<class_int>` surface **)** const
  69. Returns the :ref:`Material<class_Material>` for a surface of the :ref:`Mesh<class_Mesh>` resource.
  70. .. _class_MeshInstance_get_surface_material_count:
  71. - :ref:`int<class_int>` **get_surface_material_count** **(** **)** const
  72. .. _class_MeshInstance_set_surface_material:
  73. - void **set_surface_material** **(** :ref:`int<class_int>` surface, :ref:`Material<class_Material>` material **)**
  74. Sets the :ref:`Material<class_Material>` for a surface of the :ref:`Mesh<class_Mesh>` resource.