Turn

Turns an entity by the specified euler rotation in local or global space. This function is more accurate than simply adding units to the rotation axes and will avoid problems with Gimbal lock.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-6)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

--Create a model
model = Model:Box()
model:SetColor(0.0,0.0,1.0)
model:SetRotation(0,-90,0)

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

--Make the model move in a circle
model:Turn(0,Time:GetSpeed()*0.5,0);
model:Move(0,0,0.1);

Time:Update()
world:Update()
world:Render()
context:Sync()
end