SetAcceleration

This function sets an acceleration value for released particles.

Syntax

Returns

This function returns an integer ranging between 0 and 4 containing the specified view mode.

Remarks

float x- specified acceleration along the x-axis
float y- specified acceleration along the y-axis
float z- specified acceleration along the z-axis

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 acceleration = -0.5
emitter:SetAcceleration(0,acceleration,0)

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
acceleration = acceleration + .1
emitter:SetAcceleration(0,acceleration,0)
elseif (window:KeyDown(Key.Down)) then
acceleration = acceleration - .1
emitter:SetAcceleration(0,acceleration,0)
end

context:SetBlendMode(Blend.Alpha)
context:DrawText("Current Y-axis Acceleration: " ..emitter:GetAcceleration().y ,2,2)

context:Sync()
end