-- Derive our 'Rotate' class from 'usul.LuaScript' base class.
class 'Rotate' (usul.LuaScript)

-- Constructor must call usul.LuaScript constructor.
function Rotate:__init(luaScriptId, luaScriptEntity)
	-- Call the parent constructor
    usul.LuaScript.__init(self, luaScriptId, luaScriptEntity)
end

-- Called on every frame. Time in µs
function Rotate:Update(timeSinceLastFrameUs)
	-- Rotate 360° in 10 seconds (remember that timeSinceLastFrameUs is in µs!)
	speed = timeSinceLastFrameUs * 360 / 10000000
	self.entity.transform:Rotate(usul.Degree(speed), usul.Vector3.AXIS_Y);
end