SetRotationByVelocityMode

This function switches between two particle rotation modes: rotate by velocity and rotate by rotation speed.

Syntax

Parameters

Remarks

When particles are rotated by velocity, it is assumed that the direction the particle is pointing is to the right.

Rotate by velocity should be used anytime that particles need to face the direction that they are heading.

Particles not rotating by velocity. Arrows are not pointing in the direction that they are heading.

Particles rotating by velocity.

Example

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

--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:SetVelocity(8,8,0,1) --set a random velocity of .1 in the x and y directions
emitter:SetRotationByVelocityMode(true)
emitter:SetEmissionVolume(0,0,0)

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

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

--Press space to toggle mode
if window:KeyHit(Key.Space) then
emitter:SetRotationByVelocityMode(not emitter:GetRotationByVelocityMode())
end

context:Sync()
end