Node that instances meshes into a scenario.
    public class MeshInstance : GeometryInstance

MeshInstance is a node that takes a 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 Mesh in many places. This allows to reuse geometry and save on resources. When a Mesh has to be instanced more than thousands of times at close proximity, consider using a MultiMesh in a MultiMeshInstance instead.

Inheritance Chain

Derived Classes

Constructors

    public MeshInstance()

Properties

    public Mesh Mesh { get; set; }

The Mesh resource for the instance.

    public NodePath Skeleton { get; set; }

NodePath to the Skeleton associated with the instance.

    public Skin Skin { get; set; }

Methods

    public void CreateConvexCollision()

This helper creates a StaticBody child node with a ConvexPolygonShape collision shape calculated from the mesh geometry. It’s mainly used for testing.

    public void CreateDebugTangents()

This helper creates a MeshInstance child node with gizmos at every vertex calculated from the mesh geometry. It’s mainly used for testing.

    public void CreateTrimeshCollision()

This helper creates a StaticBody child node with a ConcavePolygonShape collision shape calculated from the mesh geometry. It’s mainly used for testing.

    [Obsolete("GetMesh is deprecated. Use the Mesh property instead.")]
    public Mesh GetMesh()

Getter for Mesh

    [Obsolete("GetSkeletonPath is deprecated. Use the Skeleton property instead.")]
    public NodePath GetSkeletonPath()

Getter for Skeleton

    [Obsolete("GetSkin is deprecated. Use the Skin property instead.")]
    public Skin GetSkin()

Getter for Skin

    public Material GetSurfaceMaterial(int surface)

Returns the Material for a surface of the Mesh resource.

    public int GetSurfaceMaterialCount()

Returns the number of surface materials.

    [Obsolete("SetMesh is deprecated. Use the Mesh property instead.")]
    public void SetMesh(Mesh mesh)

Setter for Mesh

    [Obsolete("SetSkeletonPath is deprecated. Use the Skeleton property instead.")]
    public void SetSkeletonPath(NodePath skeletonPath)

Setter for Skeleton

    [Obsolete("SetSkin is deprecated. Use the Skin property instead.")]
    public void SetSkin(Skin skin)

Setter for Skin

    public void SetSurfaceMaterial(int surface, Material material)

Sets the Material for a surface of the Mesh resource.

Tags: