My game contains photomode, where you can stop time. The problem is after I stop the time physics act incorrectly. I mean when some object where going down after bringing time to normal they suprisely are going up or other stupid direction. Why unity acts like that? Have you any idea how can I fix the problem?
Here is simple photo Mode controller:
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
timeFactor += 0.05f;
Time.timeScale = Mathf.Clamp(timeFactor, 0f, 1f);
Time.fixedDeltaTime = Time.timeScale * .02f;
timeTxt.text = Time.timeScale + "x";
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
timeFactor -= 0.05f;
Time.timeScale = Mathf.Clamp(timeFactor, 0f, 1f);
Time.fixedDeltaTime = Time.timeScale * .02f;
timeTxt.text = Time.timeScale + "x";
}
if (Input.GetKeyDown(KeyCode.Space))
{
timeFactor = 0;
Time.timeScale = timeFactor;
Time.fixedDeltaTime = Time.timeScale * .02f;
timeTxt.text = Time.timeScale + "x";
}
}