SetFacingDirection
This function manually sets a direction that all particles will face.
Syntax
- SetFacingDirection(number x, number y, number z)
Remarks
The most common application of this function is to draw particles on the ground facing up. Make sure to change the view mode to manual facing direction SetViewMode
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 self.self.emitter
emitter = Emitter:Create(1000)
emitter:SetViewMode(2) --set the view mode to manual facing direction
emitter:SetFacingDirection(0,1,0) --set particles to always face up
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:SetBlendMode(Blend.Alpha)
context:DrawText("facing direction: " .. (emitter:GetFacingDirection()):ToString() ,2,2)
context:Sync()
end