Stride Forums Archive

DeltaTime, where you at?:confused:

2 posts, 2006 views, 2017-08-06 to 2017-08-06

P-VOT 2017-08-06 #1

Does Xenko have a delta time variable to scale for frame rate?

dfkeenan 2017-08-06 #2

From within script you use Game.UpdateTime.Elapsed which will give you a TimeSpan of the “delta time”. You would most likely use TotalSeconds to do your math. i.e.:

Vector3 heading; //Some normalized direction
float walkSpeed = 1.5; //m/s

var movement = heading * walkSpeed * (float)Game.UpdateTime.Elapsed.TotalSeconds;