In Unity3D, using Time.DeltaTime doesn't result in framerate independence -
i'm trying lerp items across specified distance on determined amount of time. i'm using time.deltatime achieve framerate independence. however, when forcing lag of performance intensive function (drops framerate theoretical 10-15fps), objects move slower should, though should move in constant time, independent of framerate (they take twice long, 4s instead of 2s).
what's stranger calculated fps (1.0f/time.deltatime) stays constant (approx. 66 fps). when show time took lerp finish (adding time.deltatimes), shows 2 seconds (which desired time, actual time took @ least 2x that).
can me figure out what's going on?
var starttime = 0.0; while(starttime < 2.0){ yield; starttime += time.deltatime; transform.localposition = vector3.lerp(vector3(0.0,0.0,0.0), vector3(0.0,10.0,0.0), starttime/2.0); }
check in project time settings (under edit->project settings->time) if maximum allowed timestep high enough. value should high enough allow minimum fps want. example, max.timestep of 0.1 alllow 10fps.
Comments
Post a Comment