class_meshinstance.rst 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Node that instances meshes into a scenario.
  12. Member Functions
  13. ----------------
  14. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`create_convex_collision<class_MeshInstance_create_convex_collision>` **(** **)** |
  16. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`create_debug_tangents<class_MeshInstance_create_debug_tangents>` **(** **)** |
  18. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`create_trimesh_collision<class_MeshInstance_create_trimesh_collision>` **(** **)** |
  20. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Material<class_material>` | :ref:`get_surface_material<class_MeshInstance_get_surface_material>` **(** :ref:`int<class_int>` surface **)** const |
  22. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_surface_material<class_MeshInstance_set_surface_material>` **(** :ref:`int<class_int>` surface, :ref:`Material<class_material>` material **)** |
  24. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. Member Variables
  26. ----------------
  27. .. _class_MeshInstance_mesh:
  28. - :ref:`Mesh<class_mesh>` **mesh** - The :ref:`Mesh<class_mesh>` resource for the instance.
  29. .. _class_MeshInstance_skeleton:
  30. - :ref:`NodePath<class_nodepath>` **skeleton** - :ref:`NodePath<class_nodepath>` to the :ref:`Skeleton<class_skeleton>` associated with the instance.
  31. Description
  32. -----------
  33. 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.
  34. Member Function Description
  35. ---------------------------
  36. .. _class_MeshInstance_create_convex_collision:
  37. - void **create_convex_collision** **(** **)**
  38. 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.
  39. .. _class_MeshInstance_create_debug_tangents:
  40. - void **create_debug_tangents** **(** **)**
  41. 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.
  42. .. _class_MeshInstance_create_trimesh_collision:
  43. - void **create_trimesh_collision** **(** **)**
  44. 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.
  45. .. _class_MeshInstance_get_surface_material:
  46. - :ref:`Material<class_material>` **get_surface_material** **(** :ref:`int<class_int>` surface **)** const
  47. Returns the :ref:`Material<class_material>` for a surface of the :ref:`Mesh<class_mesh>` resource.
  48. .. _class_MeshInstance_set_surface_material:
  49. - void **set_surface_material** **(** :ref:`int<class_int>` surface, :ref:`Material<class_material>` material **)**
  50. Sets the :ref:`Material<class_material>` for a surface of the :ref:`Mesh<class_mesh>` resource.