Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 1195
Rep : 0
Join date : 2015-04-18
View user profile

Adding slow motion effect

on Sat Apr 18, 2015 8:30 am
I am creating a game and i want to add a effect like a man punches someone by pressing any key and the man dies in slow motion with music behind.Plss can anyone help me with this situation.
avatar
Member [Lv. 3]
Member [Lv. 3]
Posts : 16
Points : 1253
Rep : 0
Join date : 2015-04-13
Age : 26
Location : Milwaukee, WI
View user profilehttp://vgbam.com/

Re: Adding slow motion effect

on Sat Apr 18, 2015 11:33 am
This will allow time to slow down by 50%. Feel free to adjust the number. Then change the time back to normal with 1.

Time.timeScale = 0.5f;

0 = Stop
1 = Normal
2 = Double the speed
avatar
Moderator
Moderator
Posts : 329
Points : 2178
Rep : 43
Join date : 2014-03-12
Age : 18
Location : Italy
View user profilehttp://masterdevelopers.altervista.org/

Re: Adding slow motion effect

on Tue Apr 21, 2015 9:25 am
Like:
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;
      }
  }
Back to top
Permissions in this forum:
You cannot reply to topics in this forum