GPU Particles

self:set_mesh

Client

Draws every particle as the mesh of a model instead of a quad

Syntax

local status = self:set_mesh(
    model,
    component = all
)

The model is only a mesh source.

  • Model — the model keeps existing, destroy or hide it if it is only a mesh source.
  • Components — without component every component is used, each as its own draw pass (max 4).
  • Look — billboarding turns off, size comes from the SCALE parameter, and the mesh keeps its own materials unless self:set_material is used.

Parameters

TypeNameDescription
modelmodelModel instance to take the mesh from
stringcomponentName of a single mesh component to use
Defaults to every component of the model (up to 4)

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Draw particles as a leaf model
core.model.load("leaf", "assets/leaf.glb")

local leaf = core.model.create("leaf")
local entity = particle.gpu.create()

entity:set_mesh(leaf)
leaf:destroy()
Use a single component
core.model.load("leaf", "assets/leaf.glb")

local leaf = core.model.create("leaf")
local entity = particle.gpu.create()

entity:set_mesh(leaf, "Leaf")

On this page