0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

timeScaleとスローモーション

Posted at

timeScaleとは

timeScaleは名前の通り時間の早さを表す静的な変数です。 timeScaleが1.0の時現実と同じ速さとなり、0.5にすると半分の速さになり

Unityのリファレンスより↓

Except for realtimeSinceStartup and fixedDeltaTime, timeScale affects all the time and delta time measuring variables of the Time class.
If you lower timeScale it is recommended to also lower Time.fixedDeltaTime by the same amount.

timeScaleはrealtimeSinceStartupとfixedDeltaTimeには影響しないと書いてあります。
これはrealtimeSinceStartupはゲームが始まってからの(固定の)時間なのでもちろん影響は受けると困ります、同様にfixedDeltaTimeも固定のフレームレート(default=0.02)の更新を実行するので影響を受けないようにしているのだと思います。

ここで注意するのがもしゲームでスローモーションを実装したいとき
timeScaleを0.02にしたとします。このときfixedDeltaTimeは0.02のままなのでかくかくな画面になってしまいます。これを防ぐためにtimeScaleを小さくするときは同じだけfixedDeltaTimeも小さくすると良いそうです!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?