GPUParticlesCollisionSDF3D

package
v0.0.0-...-9b8b246 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

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 MeshInstance3Ds within the Size will be taken into account for baking, regardless of their GeometryInstance3D.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: ParticleProcessMaterial.CollisionMode must be [Particleprocessmaterial.CollisionRigid] or [Particleprocessmaterial.CollisionHideOnContact] on the GPUParticles3D's process material for collision to work.

Note: Particle collision only affects GPUParticles3D, not CPUParticles3D.

Index

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 Any

type Any interface {
	gd.IsClass
	AsGPUParticlesCollisionSDF3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsGPUParticlesCollision3D

func (self *Extension[T]) AsGPUParticlesCollision3D() GPUParticlesCollision3D.Instance

func (*Extension[T]) AsGPUParticlesCollisionSDF3D

func (self *Extension[T]) AsGPUParticlesCollisionSDF3D() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsVisualInstance3D

func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsGPUParticlesCollision3D

func (self Instance) AsGPUParticlesCollision3D() GPUParticlesCollision3D.Instance

func (Instance) AsGPUParticlesCollisionSDF3D

func (self Instance) AsGPUParticlesCollisionSDF3D() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsVisualInstance3D

func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance

func (Instance) BakeMask

func (self Instance) BakeMask() int

The visual layers to account for when baking the particle collision SDF. Only MeshInstance3Ds whose VisualInstance3D.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.

func (Instance) GetBakeMaskValue

func (self Instance) GetBakeMaskValue(layer_number int) bool

Returns whether or not the specified layer of the BakeMask is enabled, given a 'layer_number' between 1 and 32.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Resolution

func (self Instance) Resolution() 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.

func (Instance) SetBakeMask

func (self Instance) SetBakeMask(value int)

SetBakeMask sets the property returned by [GetBakeMask].

func (Instance) SetBakeMaskValue

func (self Instance) SetBakeMaskValue(layer_number int, value bool)

Based on 'value', enables or disables the specified layer in the BakeMask, given a 'layer_number' between 1 and 32.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetResolution

func (self Instance) SetResolution(value Resolution)

SetResolution sets the property returned by [GetResolution].

func (Instance) SetSize

func (self Instance) SetSize(value Vector3.XYZ)

SetSize sets the property returned by [GetSize].

func (Instance) SetTexture

func (self Instance) SetTexture(value Texture3D.Instance)

SetTexture sets the property returned by [GetTexture].

func (Instance) SetThickness

func (self Instance) SetThickness(value Float.X)

SetThickness sets the property returned by [GetThickness].

func (Instance) Size

func (self Instance) Size() Vector3.XYZ

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.

func (Instance) Texture

func (self Instance) Texture() Texture3D.Instance

The 3D texture representing the signed distance field.

func (Instance) Thickness

func (self Instance) Thickness() Float.X

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.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Resolution

type Resolution int //gd:GPUParticlesCollisionSDF3D.Resolution
const (
	// Bake a 16×16×16 signed distance field. This is the fastest option, but also the least precise.
	Resolution16 Resolution = 0
	// Bake a 32×32×32 signed distance field.
	Resolution32 Resolution = 1
	// Bake a 64×64×64 signed distance field.
	Resolution64 Resolution = 2
	// Bake a 128×128×128 signed distance field.
	Resolution128 Resolution = 3
	// Bake a 256×256×256 signed distance field.
	Resolution256 Resolution = 4
	// Bake a 512×512×512 signed distance field. This is the slowest option, but also the most precise.
	Resolution512 Resolution = 5
	// Represents the size of the [Resolution] enum.
	ResolutionMax Resolution = 6
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL