Jump to content

TimeWarp.fixedDeltaTime vs Time.fixedDeltaTime


Recommended Posts

Is there a reason one would use TimeWarp.fixedDeltaTime in their fixedUpdate for physics?

I would hope if someone were doing a physics warp, then Time.fixedDeltaTime would reflect the appropriate delta so that it can be used regardless of warp.

Link to comment
Share on other sites

My understanding is that Time.fixedDeltaTime is the basic deltaTime that comes as part of the Unity Engine defaults.

Then Squad, when they added Time Warp for KSP, added the TimeWarp class, so the difference is that Time.fixedDeltaTime is "realtime" since last fixedUpdate and ignores TimeWarp, while TimeWarp.fixedDeltaTime is the time since last frame, including compensation for Time Warp.

Fair warning that I have not actually used either, so please test if you are going to use either value.

D.

Link to comment
Share on other sites

Timewarp.(fixed)deltatime is AFAIK the KSP implementation of Time.(fixed)deltatime. You don't have to be in timewarp for the timewarp class to return correct values (but I can't comment on the reverse). I use the Timewarp versions exclusively reasoning that the KSP specific version is more likely to be correct in any given situation

Link to comment
Share on other sites

That sounds like a good best practice.

I did some test and it appears with physics warp, both values are identical, I.e. 1x .02, 4x .08

With regualr warp though, x5 has Time.fixedDelta .02, and TimeWarp.fixedDelta .10

So you are right about using TimeWarp.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...