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

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.

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.

    public Mesh GetMesh()

Getter for Mesh

    public NodePath GetSkeletonPath()

Getter for Skeleton

    public Material GetSurfaceMaterial(int surface)

Returns the Material for a surface of the Mesh resource.

    public void SetMesh(Mesh mesh)

Setter for Mesh

    public void SetSkeletonPath(NodePath skeletonPath)

Setter for Skeleton

    public void SetSurfaceMaterial(int surface, Material material)

Sets the Material for a surface of the Mesh resource.

Tags: