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.


descriptionAdding slow motion effect EmptyAdding slow motion effect

more_horiz
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.

descriptionAdding slow motion effect EmptyRe: Adding slow motion effect

more_horiz
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

_________________
I am Space! Bring Cookies, and I will bring Joy! Razz

descriptionAdding slow motion effect EmptyRe: Adding slow motion effect

more_horiz
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;
      }
  }

_________________
Game Developer
YouTube Channel: https://www.youtube.com/channel/UCra7PcIl3WqSsIChgIAmWrA
Website: http://masterdevelopers.altervista.org/

Adding slow motion effect Croppe10

descriptionAdding slow motion effect EmptyRe: Adding slow motion effect

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