Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
createTrimeshCollision
This helper creates a StaticBody3D
child node with a ConcavePolygonShape3D
collision shape calculated from the mesh geometry. It’s mainly used for testing.
final func createTrimeshCollision()
Other members in extension
Type members
Instance members
var mesh: Mesh?
The
Mesh
resource for the instance.var skeleton: NodePath
NodePath
to theSkeleton3D
associated with the instance.var skin: Skin?
The
Skin
to be used by this instance.func createConvexCollision(clean: Bool, simplify: Bool
) This helper creates a
StaticBody3D
child node with aConvexPolygonShape3D
collision shape calculated from the mesh geometry. It’s mainly used for testing.func 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 createMultipleConvexCollisions(settings: MeshConvexDecompositionSettings?
) This helper creates a
StaticBody3D
child node with multipleConvexPolygonShape3D
collision shapes calculated from the mesh geometry via convex decomposition. The convex decomposition operation can be controlled with parameters from the optionalsettings
.func findBlendShapeByName(StringName
) -> Int32 Returns the index of the blend shape with the given
name
. Returns-1
if no blend shape with this name exists, including whenmesh
isnull
.func getActiveMaterial(surface: Int32
) -> Material? Returns the
Material
that will be used by theMesh
when drawing. This can return thematerialOverride
, the surface overrideMaterial
defined in thisMeshInstance3D
, or the surfaceMaterial
defined in themesh
. For example, ifmaterialOverride
is used, all surfaces will return the override material.func getBlendShapeCount(
) -> Int32 Returns the number of blend shapes available. Produces an error if
mesh
isnull
.func getBlendShapeValue(blendShapeIdx: Int32
) -> Double Returns the value of the blend shape at the given
blendShapeIdx
. Returns0.0
and produces an error ifmesh
isnull
or doesn’t have a blend shape at that index.func getSurfaceOverrideMaterial(surface: Int32
) -> Material? Returns the override
Material
for the specifiedsurface
of theMesh
resource. See alsogetSurfaceOverrideMaterialCount
.func getSurfaceOverrideMaterialCount(
) -> Int32 Returns the number of surface override materials. This is equivalent to
getSurfaceCount
. See alsogetSurfaceOverrideMaterial(surface:)
.func setBlendShapeValue(blendShapeIdx: Int32, value: Double
) Sets the value of the blend shape at
blendShapeIdx
tovalue
. Produces an error ifmesh
isnull
or doesn’t have a blend shape at that index.func setSurfaceOverrideMaterial(surface: Int32, material: Material?
) Sets the override
material
for the specifiedsurface
of theMesh
resource. This material is associated with thisMeshInstance3D
rather than withmesh
.