GPUParticlesCollisionSDF3D
A baked signed distance field 3D particle collision shape affecting GPUParticles3D
nodes.
class GPUParticlesCollisionSDF3D
A baked signed distance field 3D particle collision shape affecting GPUParticles3D
nodes.
Signed distance fields (SDF) allow for efficiently representing approximate collision shapes for convex and concave objects of any shape. This is more flexible than GPUParticlesCollisionHeightField3D
, but it requires a baking step.
Baking: The signed distance field texture can be baked by selecting the GPUParticlesCollisionSDF3D
node in the editor, then clicking Bake SDF at the top of the 3D viewport. Any visible MeshInstance3D
s within the size
will be taken into account for baking, regardless of their giMode
.
Superclasses
class GPUParticlesCollision3D
Abstract base class for 3D particle collision shapes affecting
GPUParticles3D
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 bakeMask: UInt32
The visual layers to account for when baking the particle collision SDF. Only
MeshInstance3D
s whoselayers
match with thisbakeMask
will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking.var resolution: GPUParticlesCollisionSDF3D.Resolution
The bake resolution to use for the signed distance field
texture
. The texture must be baked again for changes to theresolution
property to be effective. Higher resolutions have a greater performance cost and take more time to bake. Higher resolutions also result in larger baked textures, leading to increased VRAM and storage space requirements. To improve performance and reduce bake times, use the lowest resolution possible for the object you’re representing the collision of.var size: Vector3
The collision SDF’s size in 3D units. To improve SDF quality, the
size
should be set as small as possible while covering the parts of the scene you need.var texture: Texture3D?
The 3D texture representing the signed distance field.
var thickness: Double
The collision shape’s thickness. Unlike other particle colliders,
GPUParticlesCollisionSDF3D
is actually hollow on the inside.thickness
can be increased to prevent particles from tunneling through the collision shape at high speeds, or when theGPUParticlesCollisionSDF3D
is moved.func getBakeMaskValue(layerNumber: Int32
) -> Bool Returns whether or not the specified layer of the
bakeMask
is enabled, given alayerNumber
between 1 and 32.func setBakeMaskValue(layerNumber: Int32, value: Bool
) Based on
value
, enables or disables the specified layer in thebakeMask
, given alayerNumber
between 1 and 32.