Fixing framerate with physX calls

Hello

As far as I understand, the framerate is independent from the physics engine calls which are called before each fixedupdate. This independence allows for physics objects to behave with the right timing, in a framerate variable environment (different computers and different CPU loads).

Is it possible to fix the number of physX calls that are run before each frame is drawn?

Or in other words is it possible to fix the frame draw call to run after an x number of physX calls?

No, but you should also explain what effect you’re trying to accomplish. If you want smoother object motion enable interpolation on your rigidbodies.

I want to get deterministic physics results.

You won’t be able to, unfortunately. This is also complicated by Unity running on totally different architectures (Intel/PPC).

What are you trying to implement, feature-wise? Replays? Physics puzzle that play out the same way every time?

I am trying to implement replays and simple online gaming.

I would either:

  • Record transforms only, ignoring physics
  • Or resync physics a few times a second (store positions/velocities for all rigidbodies)

And “simple online” is something of a paradox :wink:

Thanks Matthew. I am doing it the hard way exactly as you describe by using the Recorder project from lastbastiongames.

I just wanted it to be easier (instead of simple).