Documentation
¶
Overview ¶
Package MeshInstance3D provides methods for working with MeshInstance3D object instances.
Index ¶
- type Advanced
- type Any
- type Expanded
- func (self Expanded) BakeMeshFromCurrentBlendShapeMix(existing ArrayMesh.Instance) ArrayMesh.Instance
- func (self Expanded) BakeMeshFromCurrentSkeletonPose(existing ArrayMesh.Instance) ArrayMesh.Instance
- func (self Expanded) CreateConvexCollision(clean bool, simplify bool)
- func (self Expanded) CreateMultipleConvexCollisions(settings MeshConvexDecompositionSettings.Instance)
- 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) 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) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
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 Expanded ¶
type Expanded [1]gdclass.MeshInstance3D
func (Expanded) BakeMeshFromCurrentBlendShapeMix ¶
func (self Expanded) 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 [param existing] mesh. If no [param existing] mesh is provided a new [ArrayMesh] is created, baked and returned. Mesh surface materials are not copied. [b]Performance:[/b] [Mesh] data needs to be received from the GPU, stalling the [RenderingServer] in the process.
func (Expanded) BakeMeshFromCurrentSkeletonPose ¶
func (self Expanded) 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 [param existing] mesh. If no [param 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. [b]Performance:[/b] [Mesh] data needs to be retrieved from the GPU, stalling the [RenderingServer] in the process.
func (Expanded) 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 [param clean] is [code]true[/code] (default), duplicate and interior vertices are removed automatically. You can set it to [code]false[/code] to make the process faster if not needed. If [param simplify] is [code]true[/code], the geometry can be further simplified to reduce the number of vertices. Disabled by default.
func (Expanded) CreateMultipleConvexCollisions ¶
func (self Expanded) 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 [param settings].
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
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 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.
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 [param existing] mesh. If no [param existing] mesh is provided a new [ArrayMesh] is created, baked and returned. Mesh surface materials are not copied. [b]Performance:[/b] [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 [param existing] mesh. If no [param 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. [b]Performance:[/b] [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 [param clean] is [code]true[/code] (default), duplicate and interior vertices are removed automatically. You can set it to [code]false[/code] to make the process faster if not needed. If [param simplify] is [code]true[/code], 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 [param 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 [param name]. Returns [code]-1[/code] if no blend shape with this name exists, including when [member mesh] is [code]null[/code].
func (Instance) GetActiveMaterial ¶
Returns the [Material] that will be used by the [Mesh] when drawing. This can return the [member GeometryInstance3D.material_override], the surface override [Material] defined in this [MeshInstance3D], or the surface [Material] defined in the [member mesh]. For example, if [member GeometryInstance3D.material_override] is used, all surfaces will return the override material. Returns [code]null[/code] if no material is active, including when [member mesh] is [code]null[/code].
func (Instance) GetBlendShapeCount ¶
Returns the number of blend shapes available. Produces an error if [member mesh] is [code]null[/code].
func (Instance) GetBlendShapeValue ¶
Returns the value of the blend shape at the given [param blend_shape_idx]. Returns [code]0.0[/code] and produces an error if [member mesh] is [code]null[/code] 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 [RID] attached to this RID. See also [method Resource.get_rid], [method SkinReference.get_skeleton], and [method RenderingServer.instance_attach_skeleton].
func (Instance) GetSurfaceOverrideMaterial ¶
Returns the override [Material] for the specified [param surface] of the [Mesh] resource. See also [method get_surface_override_material_count]. [b]Note:[/b] 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 [method Mesh.surface_get_material] instead.
func (Instance) GetSurfaceOverrideMaterialCount ¶
Returns the number of surface override materials. This is equivalent to [method Mesh.get_surface_count]. See also [method get_surface_override_material].
func (Instance) SetBlendShapeValue ¶
Sets the value of the blend shape at [param blend_shape_idx] to [param value]. Produces an error if [member mesh] is [code]null[/code] or doesn't have a blend shape at that index.
func (Instance) SetSkeleton ¶
func (Instance) SetSurfaceOverrideMaterial ¶
Sets the override [param material] for the specified [param surface] of the [Mesh] resource. This material is associated with this [MeshInstance3D] rather than with [member mesh]. [b]Note:[/b] 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 [method Mesh.surface_set_material] instead.