SetRotationSpeed

This function sets the rotation speed in degrees per second of released particles.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)

local rotationspeed = 90

--Create an emitter
emitter = Emitter:Create(500)

local material = Material:Load("Materials/Effects/spark.mat")
if (material) then
emitter:SetMaterial(material)
material:Release()
end

emitter:SetVelocity(0,0,0,0) --set base velocity to 0
emitter:SetRotationSpeed(rotationspeed)

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

context:SetBlendMode(Blend.Alpha)
context:DrawText("Rotation speed: " .. emitter:GetRotationSpeed() .. " degrees per second." ,2,2)

context:Sync()
end