UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


Slow motion

power_settings_newLogin to reply
+2
Mohammed-Mrx
developer23
6 posters

descriptionSlow motion EmptySlow motion

more_horiz
Hello guys!!! when you press the key that you put in the script, time will slow down depending on the time you write in the script.Enjoy! Very Happy

Code:


   function Update () {
      if (Input.GetKeyDown (KeyCode.E)) {
         if (Time.timeScale == 1.0)
            Time.timeScale = 0.4;
         else
            Time.timeScale = 1.0;
         
         Time.fixedDeltaTime = 0.02 * Time.timeScale;
      }
   }


Last edited by developer23 on Sat Jun 21, 2014 2:34 am; edited 1 time in total

descriptionSlow motion EmptyRe: Slow motion

more_horiz
its working , thank you

descriptionSlow motion EmptyRe: Slow motion

more_horiz
Mohammed-Mrx wrote:
its working , thank you

Of nothing Very Happy

descriptionSlow motion EmptyRe: Slow motion

more_horiz
Thank you mister

descriptionSlow motion EmptyRe: Slow motion

more_horiz
turbomaniac wrote:
Thank you mister

Of nothing Wink

descriptionSlow motion EmptyRe: Slow motion

more_horiz
How do I input this? Like, where..? Very Happy 

descriptionSlow motion EmptyRe: Slow motion

more_horiz
SwagleToothWolf wrote:
How do I input this? Like, where..? Very Happy 

You should put into the player. You can change the input, i put KeyCode E for example, but you can edit

descriptionSlow motion EmptyRe: Slow motion

more_horiz
ah ok thanks, I'm like, a supernoob to unity XDXD

descriptionSlow motion EmptyRe: Slow motion

more_horiz
Thank you, very fun to use

descriptionSlow motion EmptyRe: Slow motion

more_horiz
developer23 wrote:
Hello guys!!! when you press the key that you put in the script, time will slow down depending on the time you write in the script.Enjoy! Very Happy

Code:


   function Update () {
      if (Input.GetKeyDown (KeyCode.E)) {
         if (Time.timeScale == 1.0)
            Time.timeScale = 0.4;
         else
            Time.timeScale = 1.0;
         
         Time.fixedDeltaTime = 0.02 * Time.timeScale;
      }
   }



Is this script used in C# or JavaScript?

descriptionSlow motion EmptyRe: Slow motion

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply