FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Slow motion

Share

descriptionSlow 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

descriptionRe: Slow motion

more_horiz
its working , thank you

descriptionRe: Slow motion

more_horiz
[You must be registered and logged in to see this link.] wrote:
its working , thank you

Of nothing Very Happy

descriptionRe: Slow motion

more_horiz
Thank you mister

descriptionRe: Slow motion

more_horiz
[You must be registered and logged in to see this link.] wrote:
Thank you mister

Of nothing Wink

_________________
Game Developer
YouTube Channel: [You must be registered and logged in to see this link.]
Website: [You must be registered and logged in to see this link.]

descriptionRe: Slow motion

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

descriptionRe: Slow motion

more_horiz
[You must be registered and logged in to see this link.] 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

_________________
Game Developer
YouTube Channel: [You must be registered and logged in to see this link.]
Website: [You must be registered and logged in to see this link.]

descriptionRe: Slow motion

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

descriptionRe: Slow motion

more_horiz
Thank you, very fun to use

descriptionRe: Slow motion

more_horiz
[You must be registered and logged in to see this link.] 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?
Permissions in this forum:
You cannot reply to topics in this forum