fatcargo

[RESOLVED by compromise] Animations and time warp

Recommended Posts

Posted (edited)

I need to know how to properly manage timing during physics warp and high-speed warp (the non-physics variety).

Timing is required for my animations. I can use Time.time under normal scale and it works ok, but i need a timing variable / method that reads game time and is affected by both warp types. Note that MET is not acceptable since it does not run while vessel is landed.

Edited by fatcargo

Share this post


Link to post
Share on other sites

Sigh... I've come up with this, i just don't know if Time.time is the correct source (or the ONLY source of timing info, besides MET)
 

public float scaledTime
        {
            get { return Time.time * Mathf.Max(Time.timeScale,TimeWarp.CurrentRate); }
        }

After testing i've concluded that Time.timeScale is for physics warp and TimeWarp.CurrentRate is for high-speed physics-less warp. Also note that rate changes between two steps are gradual.

Share this post


Link to post
Share on other sites

You could use  Planetarium.GetUniversalTime(). This is the total number of seconds elapsed during game time since start of save.

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks for this, i did more tests and Time.time appears to be affected by physics warp only.

Planetarium.GetUniversalTime()  does respect both warp modes.

Hmmm... I just tested stock cargo bay. Animation playback speeds are affected by physics warp only. A compromise or a bug, i can't tell.

Another thing about gameplay : when high-speed (on-rails) warp is active, part menu buttons (defined with [KSPEvent] attribute in plugin) are not available, preventing players from activating animations that make parts move in this warp mode.

Can you imagine a 15 second animation accelerated by 10000x warp ? :)  To me it looks more and more like a compromise. Interestingly, action groups are not affected, so player could still execute them.

Edited by fatcargo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now