Documentation
¶
Overview ¶
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.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self *Extension[T]) AsMeshInstance3D() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
- type ID
- type Instance
- func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self Instance) AsMeshInstance3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) BakeMeshFromCurrentBlendShapeMix() ArrayMesh.Instance
- func (self Instance) BakeMeshFromCurrentSkeletonPose() ArrayMesh.Instance
- func (self Instance) CreateConvexCollision()
- func (self Instance) CreateDebugTangents()
- func (self Instance) CreateMultipleConvexCollisions()
- func (self Instance) CreateTrimeshCollision()
- func (self Instance) FindBlendShapeByName(name string) int
- func (self Instance) GetActiveMaterial(surface int) Material.Instance
- func (self Instance) GetBlendShapeCount() int
- func (self Instance) GetBlendShapeValue(blend_shape_idx int) Float.X
- func (self Instance) GetSkinReference() SkinReference.Instance
- func (self Instance) GetSurfaceOverrideMaterial(surface int) Material.Instance
- func (self Instance) GetSurfaceOverrideMaterialCount() int
- func (self Instance) ID() ID
- func (self Instance) Mesh() Mesh.Instance
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) SetBlendShapeValue(blend_shape_idx int, value Float.X)
- func (self Instance) SetMesh(value Mesh.Instance)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSkeleton(value string)
- func (self Instance) SetSkin(value Skin.Instance)
- func (self Instance) SetSurfaceOverrideMaterial(surface int, material Material.Instance)
- func (self Instance) Skeleton() string
- func (self Instance) Skin() Skin.Instance
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
- func (self MoreArgs) BakeMeshFromCurrentBlendShapeMix(existing ArrayMesh.Instance) ArrayMesh.Instance
- func (self MoreArgs) BakeMeshFromCurrentSkeletonPose(existing ArrayMesh.Instance) ArrayMesh.Instance
- func (self MoreArgs) CreateConvexCollision(clean bool, simplify bool)
- func (self MoreArgs) CreateMultipleConvexCollisions(settings MeshConvexDecompositionSettings.Instance)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsGeometryInstance3D ¶
func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
func (*Extension[T]) AsMeshInstance3D ¶
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.MeshInstance3D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsGeometryInstance3D ¶
func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
func (Instance) AsMeshInstance3D ¶
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) BakeMeshFromCurrentBlendShapeMix ¶
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.
func (Instance) BakeMeshFromCurrentSkeletonPose ¶
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.
func (Instance) CreateConvexCollision ¶
func (self Instance) CreateConvexCollision()
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.
func (Instance) CreateDebugTangents ¶
func (self Instance) CreateDebugTangents()
This helper creates a MeshInstance3D child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing.
func (Instance) CreateMultipleConvexCollisions ¶
func (self Instance) 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'.
func (Instance) CreateTrimeshCollision ¶
func (self Instance) CreateTrimeshCollision()
This helper creates a StaticBody3D child node with a ConcavePolygonShape3D collision shape calculated from the mesh geometry. It's mainly used for testing.
func (Instance) FindBlendShapeByName ¶
Returns the index of the blend shape with the given 'name'. Returns -1 if no blend shape with this name exists, including when Mesh is null.
func (Instance) GetActiveMaterial ¶
Returns the Material that will be used by the Mesh when drawing. This can return the GeometryInstance3D.MaterialOverride, the surface override Material defined in this MeshInstance3D, or the surface Material defined in the Mesh. For example, if GeometryInstance3D.MaterialOverride is used, all surfaces will return the override material.
Returns null if no material is active, including when Mesh is null.
func (Instance) GetBlendShapeCount ¶
Returns the number of blend shapes available. Produces an error if Mesh is null.
func (Instance) GetBlendShapeValue ¶
Returns the value of the blend shape at the given 'blend_shape_idx'. Returns 0.0 and produces an error if Mesh is null or doesn't have a blend shape at that index.
func (Instance) GetSkinReference ¶
func (self Instance) GetSkinReference() SkinReference.Instance
Returns the internal SkinReference containing the skeleton's Resource.ID attached to this RID. See also Resource.GetRid, SkinReference.GetSkeleton, and RenderingServer.InstanceAttachSkeleton.
func (Instance) GetSurfaceOverrideMaterial ¶
Returns the override Material for the specified 'surface' of the Mesh resource. See also GetSurfaceOverrideMaterialCount.
Note: This returns the Material associated to the MeshInstance3D's Surface Material Override properties, not the material within the Mesh resource. To get the material within the Mesh resource, use Mesh.SurfaceGetMaterial instead.
func (Instance) GetSurfaceOverrideMaterialCount ¶
Returns the number of surface override materials. This is equivalent to Mesh.GetSurfaceCount. See also GetSurfaceOverrideMaterial.
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) SetBlendShapeValue ¶
Sets the value of the blend shape at 'blend_shape_idx' to 'value'. Produces an error if Mesh is null or doesn't have a blend shape at that index.
func (Instance) SetSkeleton ¶
func (Instance) SetSurfaceOverrideMaterial ¶
Sets the override 'material' for the specified 'surface' of the Mesh resource. This material is associated with this MeshInstance3D rather than with Mesh.
Note: This assigns the Material associated to the MeshInstance3D's Surface Material Override properties, not the material within the Mesh resource. To set the material within the Mesh resource, use Mesh.SurfaceSetMaterial instead.
type MoreArgs ¶
type MoreArgs [1]gdclass.MeshInstance3D
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) BakeMeshFromCurrentBlendShapeMix ¶
func (self MoreArgs) BakeMeshFromCurrentBlendShapeMix(existing ArrayMesh.Instance) ArrayMesh.Instance
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.
func (MoreArgs) BakeMeshFromCurrentSkeletonPose ¶
func (self MoreArgs) BakeMeshFromCurrentSkeletonPose(existing ArrayMesh.Instance) ArrayMesh.Instance
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.
func (MoreArgs) CreateConvexCollision ¶
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.
func (MoreArgs) CreateMultipleConvexCollisions ¶
func (self MoreArgs) CreateMultipleConvexCollisions(settings MeshConvexDecompositionSettings.Instance)
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'.