da6a2e53ba
* New Lua Scripting System * Update Scripts * Small fix on wiLua Globals * Add One More Note To The New Demo * -path fix -renamed new_script_demo.lua to script_tracking.lua -refactors -version bump to 0.71.0 * removed GetScriptPath() Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com>
25 lines
1.1 KiB
Lua
25 lines
1.1 KiB
Lua
-- This script will load a particle emitter model and burst-spawn particles from it periodically
|
|
killProcesses() -- stops all running lua coroutine processes
|
|
|
|
backlog_post("---> START SCRIPT: emitter_burst.lua")
|
|
|
|
scene = GetScene()
|
|
scene.Clear()
|
|
LoadModel(script_dir() .. "../models/emitter_smoke.wiscene")
|
|
emitter_entity = scene.Entity_FindByName("smoke") -- query the emitter entity by name
|
|
emitter_component = scene.Component_GetEmitter(emitter_entity)
|
|
emitter_component.SetEmitCount(0) -- don't emit continuously
|
|
emitter_component.SetNormalFactor(20) -- set starting speed to particles
|
|
emitter_component.SetLife(0.3) -- particles will be short lived (around 0.3 sec if we don't account for life randomness)
|
|
emitter_component.SetSize(0.1) -- adjust starting particle size
|
|
emitter_component.SetMotionBlurAmount(0.008) -- set a little motion blur (particles will be longer along movement direction)
|
|
|
|
runProcess(function()
|
|
while true do
|
|
emitter_component.Burst(50) -- Burst 50 particles at once
|
|
waitSeconds(2) -- then wait for 2 seconds before bursting again
|
|
end
|
|
end)
|
|
|
|
backlog_post("---> END SCRIPT: emitter_burst.lua")
|