What's better to use for physics fixed update or update?

I don’t know much and just had a general question on the best use cases for a fixed update compared to an update. I’ve only heard people say that fixed update is good for physics because it’s constant apparently? but I have no clue.

Here’s a good explanation that shows the difference:

In short, normally physics calculations are best done in FixedUpdate, such as rigidbody velocity, etc.

FixedUpdate should generally be used anytime you are adding forces directly to a rigidbody. The Force calculation can happen immediately and the velocity can be adjusted, essentially discarding that force and leaving only it’s effect on the rigidbody recorded.

Since “AddForce” and “AddTorque” is kind of the recommended approach to manipulating 3D objects in Unity3D in a way that lets the physics system take total control, the general guideline is “if using physics”, then you use FixedUpdate().

However, that general advice doesn’t seem to apply when not using “AddForce” and “AddTorque”. It could apply to things like “MovePosition”, I’m not sure. But it generally does not apply when directly changing velocity, or using a non-rigidbody method to move something such as a transform method, altering a transform property, or using the animator.

Also it seems like there’s a lot of ways one can “use physics” without using AddTorque and AddForce. Using raycasts, overlap shapes, and colliders, for example, all use the Unity physics system that don’t really have anything to do with FixedUpdate.

Nonetheless, you’ll hear a lot of people say “when using physics, you should use FixedUpdate” and I think that’s still what the docs say, but a deep dive into it shows this general advice is not always the case.

One could argue that if not using AddTorque and AddForce then you are “not really using physics” or “only partially using the physics system”, or even that “using physics means more than just using the physics system” and I think one of these represents the perspective the Unity docs have.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms