Im trying to get a slow motion on the game im making but it looks realy laggy. Im using the FPS controller from the standard assets given by unity.I attached this script to it :
function Update ()
{
if (Input.GetKeyDown ("q"))
{
Time.timeScale = 0.5;
}
if (Input.GetKeyDown ("e"))
{
Time.timeScale = 2.0;
}
if (Input.GetKeyDown ("t"))
{
Time.timeScale = 1.0;
}
}
I know this is a similar question to this one http://answers.unity3d.com/questions/39279/how-to-get-smooth-slow-motion.html
but the fixes given on that question won't work.I tried adding a rigidbody to it and putting the Interpolation to Interpolate but it doesn't do anything.(I removed the tick from "Use Gravity" because the character started flying).Im new in unity and scripting so please go easy on me.
Thank you.
You should change Time.fixedDeltaTime as well:
function Update () {
if (Input.GetKeyDown ("q")){
Time.timeScale = 0.5;
Time.fixedDeltaTime = 0.02F * Time.timeScale;
}
}
To return it to normal motion again you should call these two lines
Time.timeScale = 1;
Time.fixedDeltaTime = 0.02F * Time.timeScale;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With