reckfellENGINE

MeshInstance3D

Entity that instances meshes into a scenario.

On this page
class MeshInstance3DReckfellSharpInherits GeometryInstance3D

Entity that instances meshes into a scenario.

MeshInstance3D 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 render 3D geometry and can be used to instance a single Mesh in many places. This allows reusing geometry, which can save on resources. When a Mesh has to be instantiated more than thousands of times at close proximity, consider using a MultiMesh in a MultiMeshInstance3D instead.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

MeshInstance3DConstructor
# MeshInstance3D
C#
public MeshInstance3D();

Properties3

MeshProperty
# Mesh
C#
public Mesh Mesh { get; set; }

The Mesh resource for the instance.

SkeletonProperty
# Skeleton
C#
public EntityPath Skeleton { get; set; }

EntityPath to the Skeleton3D associated with the instance. Note: The default value of this property has changed in Reckfell. Enable ProjectSettings.animation/compatibility/default_parent_skeleton_in_mesh_instance_3d if the old behavior is needed for compatibility.

SkinProperty
# Skin
C#
public Skin Skin { get; set; }

The Skin to be used by this instance.

Methods22

BakeMeshFromCurrentBlendShapeMixArrayMesh
# BakeMeshFromCurrentBlendShapeMix
C#
public ArrayMesh BakeMeshFromCurrentBlendShapeMix(ArrayMesh existing = null);

Takes a snapshot from the current ArrayMesh with all blend shapes applied according to their current weights and bakes it to the provided existing mesh. If no existing mesh is provided a new ArrayMesh is created, baked and returned. Mesh surface materials are not copied. Performance: Mesh data needs to be received from the GPU, stalling the RenderingServer in the process.

Parameters
NameTypeDefault
existingArrayMeshnull
Returns ArrayMesh
BakeMeshFromCurrentSkeletonPoseArrayMesh
# BakeMeshFromCurrentSkeletonPose
C#
public ArrayMesh BakeMeshFromCurrentSkeletonPose(ArrayMesh existing = null);

Takes a snapshot of the current animated skeleton pose of the skinned mesh and bakes it to the provided existing mesh. If no existing mesh is provided a new ArrayMesh is created, baked, and returned. Requires a skeleton with a registered skin to work. Blendshapes are ignored. Mesh surface materials are not copied. Performance: Mesh data needs to be retrieved from the GPU, stalling the RenderingServer in the process.

Parameters
NameTypeDefault
existingArrayMeshnull
Returns ArrayMesh
CreateConvexCollisionvoid
# CreateConvexCollision
C#
public void CreateConvexCollision(bool clean = true, bool simplify = false);

This helper creates a StaticBody3D child node with a ConvexPolygonShape3D collision shape calculated from the mesh geometry. It's mainly used for testing. If clean is true (default), duplicate and interior vertices are removed automatically. You can set it to false to make the process faster if not needed. If simplify is true, the geometry can be further simplified to reduce the number of vertices. Disabled by default.

Parameters
NameTypeDefault
cleanbooltrue
simplifyboolfalse
CreateDebugTangentsvoid
# CreateDebugTangents
C#
public void CreateDebugTangents();

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

CreateMultipleConvexCollisions2 overloads
# CreateMultipleConvexCollisions · 1/2
C#
public void CreateMultipleConvexCollisions();

This helper creates a StaticBody3D child node with multiple ConvexPolygonShape3D collision shapes calculated from the mesh geometry via convex decomposition. The convex decomposition operation can be controlled with parameters from the optional settings.

# CreateMultipleConvexCollisions · 2/2
C#
public void CreateMultipleConvexCollisions(MeshConvexDecompositionSettings settings = null);

This helper creates a StaticBody3D child node with multiple ConvexPolygonShape3D collision shapes calculated from the mesh geometry via convex decomposition. The convex decomposition operation can be controlled with parameters from the optional settings.

Parameters
NameTypeDefault
settingsMeshConvexDecompositionSettingsnull
CreateTrimeshCollisionvoid
# CreateTrimeshCollision
C#
public void CreateTrimeshCollision();

This helper creates a StaticBody3D child node with a ConcavePolygonShape3D collision shape calculated from the mesh geometry. It's mainly used for testing.

FindBlendShapeByNameint
# FindBlendShapeByName
C#
public int FindBlendShapeByName(StringName name);

Returns the index of the blend shape with the given name. Returns -1 if no blend shape with this name exists, including when MeshInstance3D.Mesh is null.

Parameters
NameTypeDefault
nameStringName—
Returns int
GetActiveMaterialMaterial
# GetActiveMaterial
C#
public Material GetActiveMaterial(int surface);

Selects the surface base material in order: instance MaterialOverride, surface override, then Mesh resource material. MaterialOverlay is an additional pass and is not included in this returned base material.

Parameters
NameTypeDefault
surfaceint—
surface

Existing mesh surface index starting at 0, not an entity or GridMap item index.

Returns Material

Selected Material, or null if no suitable resource exists. This is a resource reference; multiple instances can share it.

GetBlendShapeCountint
# GetBlendShapeCount
C#
public int GetBlendShapeCount();

Returns the number of blend shapes available. Produces an error if MeshInstance3D.Mesh is null.

Returns int
GetBlendShapeValuefloat
# GetBlendShapeValue
C#
public float GetBlendShapeValue(int blendShapeIdx);

Returns the value of the blend shape at the given blend_shape_idx. Returns 0.0 and produces an error if MeshInstance3D.Mesh is null or doesn't have a blend shape at that index.

Parameters
NameTypeDefault
blendShapeIdxint—
Returns float
GetMeshMesh
# GetMesh
C#
public Mesh GetMesh();
Returns Mesh
GetSkeletonPathEntityPath
# GetSkeletonPath
C#
public EntityPath GetSkeletonPath();
Returns EntityPath
GetSkinSkin
# GetSkin
C#
public Skin GetSkin();
Returns Skin
GetSkinReferenceSkinReference
# GetSkinReference
C#
public SkinReference GetSkinReference();

Returns the internal SkinReference containing the skeleton's Rid attached to this RID. See also Resource.GetRid, SkinReference.GetSkeleton, and RenderingServer.InstanceAttachSkeleton.

Returns SkinReference
GetSurfaceOverrideMaterialMaterial
# GetSurfaceOverrideMaterial
C#
public Material GetSurfaceOverrideMaterial(int surface);

Returns the stored surface override for this instance, not the Mesh material or necessarily the active base material. Object MaterialOverride takes priority; use GetActiveMaterial to resolve base-material priority.

Parameters
NameTypeDefault
surfaceint—
surface

Existing surface-slot index starting at zero.

Returns Material

Assigned override Material, or null even when the Mesh resource has a material.

GetSurfaceOverrideMaterialCountint
# GetSurfaceOverrideMaterialCount
C#
public int GetSurfaceOverrideMaterialCount();

Number of override slots corresponding to Mesh surfaces, not the count of assigned materials. One surface with a null override still returns 1.

Returns int

Number of surface override slots.

SetBlendShapeValuevoid
# SetBlendShapeValue
C#
public void SetBlendShapeValue(int blendShapeIdx, float value);

Sets the value of the blend shape at blend_shape_idx to value. Produces an error if MeshInstance3D.Mesh is null or doesn't have a blend shape at that index.

Parameters
NameTypeDefault
blendShapeIdxint—
valuefloat—
SetMeshvoid
# SetMesh
C#
public void SetMesh(Mesh mesh);
Parameters
NameTypeDefault
meshMesh—
SetSkeletonPathvoid
# SetSkeletonPath
C#
public void SetSkeletonPath(EntityPath skeletonPath);
Parameters
NameTypeDefault
skeletonPathEntityPath—
SetSkinvoid
# SetSkin
C#
public void SetSkin(Skin skin);
Parameters
NameTypeDefault
skinSkin—
SetSurfaceOverrideMaterialvoid
# SetSurfaceOverrideMaterial
C#
public void SetSurfaceOverrideMaterial(int surface, Material material);

Overrides one surface on this instance without changing the source Mesh. Instance MaterialOverride takes precedence. Pass null to clear the surface override.

Parameters
NameTypeDefault
surfaceint—
materialMaterial—
surface

Existing surface index starting at 0.

material

Material resource or null. Assignment does not create a unique copy; duplicate the material before independent editing.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.