SetEmissionVolume

This function specifies the area in which a particle will spawn.

Syntax

Remarks

If you want all particles to spawn at a single point set each parameter equal to 0.

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

--Create an emitter
emitter = Emitter:Create(100)
local sz = 1
emitter:SetEmissionVolume(sz,sz,sz)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()

if (window:KeyDown(Key.Up)) then
sz = sz + 0.05
emitter:SetEmissionVolume(sz,sz,sz)
elseif (window:KeyDown(Key.Down)) then
sz = sz - 0.05
sz = math.max(sz,0)
emitter:SetEmissionVolume(sz,sz,sz)
end

context:SetBlendMode(Blend.Alpha)
context:DrawText("Emission volume: "..emitter:GetEmissionVolume():ToString(),0,0)

context:Sync()
end