GetGameTime

From LoTROInterface Wiki

Jump to: navigation, search


Gets the current relative game time.

Syntax

Lua
function Engine.GetGameTime();

Returns

Type: number
Returns a relative game time in seconds.

Remarks

Gets the current game time as a relative value that can be used for delta time processing.

Examples

This example demonstrates using GetGameTime to calculate the delta time over multiple updates for performing animations.


Calculating Delta Time
local currentGameTime = Turbine.Engine.GetGameTime();
local delta = currentGameTime - previousGameTime;
previousGameTime = currentGameTime;

-- Performing a translation from one position to another over a 5
-- second period.
self:SetLeft( self.startLeft + ( self.endLeft - self.StartLeft ) * ( delta / 5 ) );
Personal tools