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 ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsGPUParticlesCollision3D() GPUParticlesCollision3D.Instance
- func (self *Extension[T]) AsGPUParticlesCollisionSDF3D() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
- type ID
- type Instance
- func (self Instance) AsGPUParticlesCollision3D() GPUParticlesCollision3D.Instance
- func (self Instance) AsGPUParticlesCollisionSDF3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) BakeMask() int
- func (self Instance) GetBakeMaskValue(layer_number int) bool
- func (self Instance) ID() ID
- func (self Instance) Resolution() Resolution
- func (self Instance) SetBakeMask(value int)
- func (self Instance) SetBakeMaskValue(layer_number int, value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetResolution(value Resolution)
- func (self Instance) SetSize(value Vector3.XYZ)
- func (self Instance) SetTexture(value Texture3D.Instance)
- func (self Instance) SetThickness(value Float.X)
- func (self Instance) Size() Vector3.XYZ
- func (self Instance) Texture() Texture3D.Instance
- func (self Instance) Thickness() Float.X
- func (self Instance) Virtual(name string) reflect.Value
- type Resolution
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 Extension ¶
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 (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type 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.
type Instance ¶
type Instance [1]gdclass.GPUParticlesCollisionSDF3D
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 (Instance) AsGPUParticlesCollision3D ¶
func (self Instance) AsGPUParticlesCollision3D() GPUParticlesCollision3D.Instance
func (Instance) AsGPUParticlesCollisionSDF3D ¶
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) BakeMask ¶
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 ¶
Returns whether or not the specified layer of the BakeMask is enabled, given a 'layer_number' between 1 and 32.
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 ¶
SetBakeMask sets the property returned by [GetBakeMask].
func (Instance) SetBakeMaskValue ¶
Based on 'value', enables or disables the specified layer in the BakeMask, given a 'layer_number' between 1 and 32.
func (Instance) SetResolution ¶
func (self Instance) SetResolution(value Resolution)
SetResolution sets the property returned by [GetResolution].
func (Instance) SetTexture ¶
SetTexture sets the property returned by [GetTexture].
func (Instance) SetThickness ¶
SetThickness sets the property returned by [GetThickness].
func (Instance) 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.
func (Instance) 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.
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 )