GPU Particles

self:set_collision

Client

Sets how particles react when they touch the world collider

Syntax

local status = self:set_collision(
    mode,
    bounce = 0,
    friction = 0
)

Needs the world collider.

  • Collider — create it once with particle.gpu.set_world_collision, particles only collide inside the volume it covers.
  • Splashes — combine HIDE with self:set_sub_emitter to spawn another emitter's particles where each particle lands.
  • Bounce and friction — only used by RIGID.

Parameters

TypeNameDescription
particle.gpu.collision_modemodeCollision mode to apply
floatbounceDetermines how much speed is kept after a bounce
Clamped between 0 and 1
floatfrictionDetermines how much a particle is slowed while sliding
Clamped between 0 and 1

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Let particles bounce off the ground
local entity = particle.gpu.create()

particle.gpu.set_world_collision(true)
entity:set_collision(particle.gpu.collision_mode.RIGID, 0.4, 0.2)
Make particles disappear on contact
local entity = particle.gpu.create()

particle.gpu.set_world_collision(true)
entity:set_collision(particle.gpu.collision_mode.HIDE)

On this page