:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the MeshInstance.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_MeshInstance: MeshInstance ============ **Inherits:** :ref:`GeometryInstance` **<** :ref:`VisualInstance` **<** :ref:`Spatial` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`SoftBody` **Category:** Core Brief Description ----------------- Node that instances meshes into a scenario. Properties ---------- +---------------------------------+-------------------------------------------------------+ | :ref:`Mesh` | :ref:`mesh` | +---------------------------------+-------------------------------------------------------+ | :ref:`NodePath` | :ref:`skeleton` | +---------------------------------+-------------------------------------------------------+ Methods ------- +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_convex_collision` **(** **)** | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_debug_tangents` **(** **)** | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_trimesh_collision` **(** **)** | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Material` | :ref:`get_surface_material` **(** :ref:`int` surface **)** const | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_surface_material_count` **(** **)** const | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_surface_material` **(** :ref:`int` surface, :ref:`Material` material **)** | +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ Description ----------- MeshInstance is a node that takes a :ref:`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` in many places. This allows to reuse geometry and save on resources. When a :ref:`Mesh` has to be instanced more than thousands of times at close proximity, consider using a :ref:`MultiMesh` in a :ref:`MultiMeshInstance` instead. Property Descriptions --------------------- .. _class_MeshInstance_property_mesh: - :ref:`Mesh` **mesh** +----------+-----------------+ | *Setter* | set_mesh(value) | +----------+-----------------+ | *Getter* | get_mesh() | +----------+-----------------+ The :ref:`Mesh` resource for the instance. ---- .. _class_MeshInstance_property_skeleton: - :ref:`NodePath` **skeleton** +----------+--------------------------+ | *Setter* | set_skeleton_path(value) | +----------+--------------------------+ | *Getter* | get_skeleton_path() | +----------+--------------------------+ :ref:`NodePath` to the :ref:`Skeleton` associated with the instance. Method Descriptions ------------------- .. _class_MeshInstance_method_create_convex_collision: - void **create_convex_collision** **(** **)** This helper creates a :ref:`StaticBody` child node with a :ref:`ConvexPolygonShape` collision shape calculated from the mesh geometry. It's mainly used for testing. ---- .. _class_MeshInstance_method_create_debug_tangents: - void **create_debug_tangents** **(** **)** This helper creates a :ref:`MeshInstance` child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing. ---- .. _class_MeshInstance_method_create_trimesh_collision: - void **create_trimesh_collision** **(** **)** This helper creates a :ref:`StaticBody` child node with a :ref:`ConcavePolygonShape` collision shape calculated from the mesh geometry. It's mainly used for testing. ---- .. _class_MeshInstance_method_get_surface_material: - :ref:`Material` **get_surface_material** **(** :ref:`int` surface **)** const Returns the :ref:`Material` for a surface of the :ref:`Mesh` resource. ---- .. _class_MeshInstance_method_get_surface_material_count: - :ref:`int` **get_surface_material_count** **(** **)** const Returns the number of surface materials. ---- .. _class_MeshInstance_method_set_surface_material: - void **set_surface_material** **(** :ref:`int` surface, :ref:`Material` material **)** Sets the :ref:`Material` for a surface of the :ref:`Mesh` resource.