Bullet time Matrix style

Hello guys

I want to make an effect like the bullet time in Matrix (like Max Paine too). But I dont know how to slowdown the time without affecting the framerate (I mean I want the framerate keep being high while the objects slow down).

I work with physics a lot and I should slowdown all the objects, making them restart (after the bullet time) with the same physic properties (Velocity, Forces, etc)

Should I act on timeScale or fixedDeltaTime or what?

You’re absolutely right, Time.timeScale is for situtations like this. You need to think a bit about the fixed framerate too, so you should check this to get the full picture:

http://unity3d.com/Documentation/ScriptReference/Time-timeScale.html

d.

Sorry to do gravedigging here, but I manage to freeze Unity by setting Time.fixedDeltaTime = 0. Is that prohibited, or should I go looking elsewhere for the problem…?

TIA! :slight_smile:

(Edit: Wasn’t as far out in the graveyard as I thought, assumed the thread was ancient… :slight_smile: )

…and a small followup question:

What if I want to pause a game (which involves physics), but still be able to use framerate independent UI elements (that rely on Update and Time.deltaTime)?

It seems I do lots of replying to my own posts… :slight_smile:

I can see why it’s problematic to set fixedDeltaTime = 0, as it’s the interval between fixedupdate-calls.
(However, the docs advices to lower the value when you lower timeScale…is that really right?)

Anyway, setting a higher value for fixedDeltaTime at first gives the impression that it pauses the physics engine, but it doesn’t. When the value is set back to default (0.02?), the solution jumps to a new state (which has been reached “behind the scenes”).

So I assume pausing physics is done in another way. I’ll search a bit as it must have been discussed before.

TimeScale = 0 → FixedUpdate() (that is where you code physics driven object) isn’t executed → game goes in pause!

You put graphic objects (the ones you want to keep move, like cameras), into Update() and use Time.realtimeSinceStartup to get the running time, since it isn’t affected by TimeScale

Am I right guys?

Yep.
Thanks for the realtimeSinceStartup variable - had overlooked that. Using it to increment stuff in Update() means the UI can still be framerate independent while the game itself if paused. Nice. :slight_smile:

u’re welcome