GetVelocity

This function returns the initial velocity or the random velocity of released particles.

Syntax

Parameters

Returns

This function returns a Vec3 containing the set initial velocity of released particles.

Remarks

Please note: Starting velocity is calculated as follows: StartVelocity = velocity[0] + Random(-.5*velocity[1], .5*velocity[1]).

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 timercount=0

while true do

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

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

timercount = timercount + 1

if(timercount % 100 == 0) then
emitter:SetVelocity(Math:Random(-1,1),Math:Random(-1,1),Math:Random(-1,1),0)
emitter:SetVelocity(Math:Random(-1,1),Math:Random(-1,1),Math:Random(-1,1),1)
end

context:SetBlendMode(Blend.Alpha)
context:DrawText("Current Base Velocity: "..(emitter:GetVelocity(0)):ToString(),2,2)
context:DrawText("Current Random Velocity: " .. (emitter:GetVelocity(1)):ToString(),2,20)

context:Sync()
end