- Home /
Question by
lonelycamper · May 10, 2019 at 04:36 PM ·
physicstime
changing time messes up the speed of my rigid bodies after its gets reset back to normal
using UnityEngine;
public class TimeManager : MonoBehaviour
{
public float slowdownFactor = 0.05f;
public float slowdownLength = 2f;
void Update()
{
Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime;
Time.timeScale = Mathf.Clamp(Time.timeScale, 0, 1f);
}
public void DoSlowmotion()
{
Time.timeScale = slowdownFactor;
Time.fixedDeltaTime = Time.timeScale * .02f;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612201126im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Stop physics without using Time.timeScale = 0? 6 Answers
Physics behaves more strangely with Time? Bouncing and Sliding Objects 2 Answers
Countdown little help...! 1 Answer
Force mode and delta timing 1 Answer
Stabilizing ragdolls in slow motion 0 Answers