Class GpuParticlesCollisionSdf3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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 visibleMeshInstance3Ds within the Size will be taken into account for baking, regardless of their GIMode.
Note: Baking a GpuParticlesCollisionSdf3D's Texture is only possible within the editor, as there is no bake method exposed for use in exported projects. However, it's still possible to load pre-baked Texture3Ds into its Texture property in an exported project.
Note: CollisionMode must be Rigid or HideOnContact on the GpuParticles3D's process material for collision to work.
Note: Particle collision only affects GpuParticles3D, not CpuParticles3D.
[GodotClassName("GPUParticlesCollisionSDF3D")]
public class GpuParticlesCollisionSdf3D : GpuParticlesCollision3D, IDisposable
- Inheritance
-
GpuParticlesCollisionSdf3D
- Implements
- Inherited Members
Constructors
GpuParticlesCollisionSdf3D()
public GpuParticlesCollisionSdf3D()
Properties
BakeMask
The visual layers to account for when baking the particle collision SDF. Only MeshInstance3Ds whose Layers match with this BakeMask will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking.
public uint BakeMask { get; set; }
Property Value
Resolution
The bake resolution to use for the signed distance field Texture. The texture must be baked again for changes to the Resolution 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.
public GpuParticlesCollisionSdf3D.ResolutionEnum Resolution { get; set; }
Property Value
Size
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.
public Vector3 Size { get; set; }
Property Value
Texture
The 3D texture representing the signed distance field.
public Texture3D Texture { get; set; }
Property Value
Thickness
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 the GpuParticlesCollisionSdf3D is moved.
public float Thickness { get; set; }
Property Value
Methods
GetBakeMaskValue(int)
Returns whether or not the specified layer of the BakeMask is enabled, given a layerNumber
between 1 and 32.
public bool GetBakeMaskValue(int layerNumber)
Parameters
layerNumber
int
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
SetBakeMaskValue(int, bool)
Based on value
, enables or disables the specified layer in the BakeMask, given a layerNumber
between 1 and 32.
public void SetBakeMaskValue(int layerNumber, bool value)