GetViewMode
This function returns which view mode is currently set.
Syntax
Returns
This function returns an integer ranging between 0 and 4 containing the specified view mode.
Remarks
0 = billlboard - In this mode each particle will always face the camera.
1 = lock Y-axis - particles will rotate to face the camera in every direction except along the Y-axis.
2 = manual facing direction - particles will always face the direction specified by SetFacingDirection
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,-1,-1)
camera:Turn(-45,0,0)
local viewmode = 0
--Create an emitter
emitter = Emitter:Create(100)
emitter:SetViewMode(viewmode) --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()
--detect key hits to switch view modes
if (window:KeyHit(Key.Up) and viewmode < 2) then
viewmode = viewmode + 1
emitter:SetViewMode(viewmode)
elseif (window:KeyHit(Key.Down) and viewmode > 0) then
viewmode = viewmode -1
emitter:SetViewMode(viewmode)
end
context:SetBlendMode(Blend.Alpha)
if (emitter:GetViewMode() == 0) then
context:DrawText("View Mode: Billboard. ",2,2)
elseif (emitter:GetViewMode() == 1) then
context:DrawText("View Mode: Lock Y-axis. ",2,2)
elseif (emitter:GetViewMode() == 2) then
context:DrawText("View Mode: Manual Direction. ",2,2)
end
context:Sync()
end