Answers for "unity slow motion"

C#
0

unity slow motion

using UnityEngine;

public class TimeManager : MonoBehaviour
{
    public float slowdownFactor = 0.05f;
    public float slowdownLength = 3f;

    void Update()
    {
        Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime;
        Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
    }

    void doSlowmotion()
    {
        if(OVRInput.GetDown( //input ))
        Time.timeScale = slowdownFactor;
        Time.fixedDeltaTime = Time.timeScale * .02f;
    }

}
Posted by: Guest on January-25-2020
0

slow mo in unity

using UnityEngine;

public class SlowMo : MonoBehaviour
{
    void Update()
    {
    if (Input.GetKeyDown(KeyCode.//input key))
        {
        Time.timeScale = 0.3f; //<-- this value is for slow down intensity
        }
    if (Input.GetKeyUp(KeyCode.//input key))
        {
        Time.timeScale = 1f;
        }        
    }
}
Posted by: Guest on June-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language