GeometryInstance3D
Base node for geometry-based visual instances.
GeometryInstance3D.swift:11class GeometryInstance3D
Base node for geometry-based visual instances. Shares some common functionality like visibility and custom materials.
Superclasses
class VisualInstance3D
Parent of all visual 3D nodes.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var castShadow: GeometryInstance3D.ShadowCastingSetting
The selected shadow casting flag. See
ShadowCastingSetting
for possible values.var customAabb: AABB
Overrides the bounding box of this node with a custom one. This can be used to avoid the expensive
AABB
recalculation that happens when a skeleton is used with aMeshInstance3D
or to have fine control over theMeshInstance3D
’s bounding box. To use the default AABB, set value to anAABB
with all fields set to0.0
. To avoid frustum culling, setcustomAabb
to a very large AABB that covers your entire game world such asAABB(-10000, -10000, -10000, 20000, 20000, 20000)
. To disable all forms of culling (including occlusion culling), callinstanceSetIgnoreCulling(instance:enabled:)
on theGeometryInstance3D
’sRID
.var extraCullMargin: Double
The extra distance added to the GeometryInstance3D’s bounding box (
AABB
) to increase its cull box.var giLightmapScale: GeometryInstance3D.LightmapScale
The texel density to use for lightmapping in
LightmapGI
. Greater scale values provide higher resolution in the lightmap, which can result in sharper shadows for lights that have both direct and indirect light baked. However, greater scale values will also increase the space taken by the mesh in the lightmap texture, which increases the memory, storage, and bake time requirements. When using a single mesh at different scales, consider adjusting this value to keep the lightmap texel density consistent across meshes.var giMode: GeometryInstance3D.GIMode
The global illumination mode to use for the whole geometry. To avoid inconsistent results, use a mode that matches the purpose of the mesh during gameplay (static/dynamic).
var ignoreOcclusionCulling: Bool
If
true
, disables occlusion culling for this instance. Useful for gizmos that must be rendered even when occlusion culling is in use.var lodBias: Double
Changes how quickly the mesh transitions to a lower level of detail. A value of 0 will force the mesh to its lowest level of detail, a value of 1 will use the default settings, and larger values will keep the mesh in a higher level of detail at farther distances.
var materialOverlay: Material?
The material overlay for the whole geometry.
var materialOverride: Material?
The material override for the whole geometry.
var transparency: Double
The transparency applied to the whole geometry (as a multiplier of the materials’ existing transparency).
0.0
is fully opaque, while1.0
is fully transparent. Values greater than0.0
(exclusive) will force the geometry’s materials to go through the transparent pipeline, which is slower to render and can exhibit rendering issues due to incorrect transparency sorting. However, unlike using a transparent material, settingtransparency
to a value greater than0.0
(exclusive) will not disable shadow rendering.var visibilityRangeBegin: Double
Starting distance from which the GeometryInstance3D will be visible, taking
visibilityRangeBeginMargin
into account as well. The default value of 0 is used to disable the range check.var visibilityRangeBeginMargin: Double
Margin for the
visibilityRangeBegin
threshold. The GeometryInstance3D will only change its visibility state when it goes over or under thevisibilityRangeBegin
threshold by this amount.var visibilityRangeEnd: Double
Distance from which the GeometryInstance3D will be hidden, taking
visibilityRangeEndMargin
into account as well. The default value of 0 is used to disable the range check.var visibilityRangeEndMargin: Double
Margin for the
visibilityRangeEnd
threshold. The GeometryInstance3D will only change its visibility state when it goes over or under thevisibilityRangeEnd
threshold by this amount.var visibilityRangeFadeMode: GeometryInstance3D.VisibilityRangeFadeMode
Controls which instances will be faded when approaching the limits of the visibility range. See
VisibilityRangeFadeMode
for possible values.func getInstanceShaderParameter(name: StringName
) -> Variant Get the value of a shader parameter as set on this instance.
func setInstanceShaderParameter(name: StringName, value: Variant
) Set the value of a shader uniform for this instance only (per-instance uniform). See also
setShaderParameter(param:value:)
to assign a uniform on all instances using the sameShaderMaterial
.
Subclasses
class CPUParticles3D
A CPU-based 3D particle emitter.
class CSGShape3D
The CSG base class.
class GPUParticles3D
A 3D particle emitter.
class Label3D
A node for displaying plain text in 3D space.
class MeshInstance3D
Node that instances meshes into a scenario.
class MultiMeshInstance3D
Node that instances a
MultiMesh
.class SpriteBase3D
2D sprite node in 3D environment.