x


FixedUpdate vs. Update for instantaneous ForceMode's

If I have a script that is only adding forces with Impulse or VelocityChange, is there any reason to use FixedUpdate instead of Update?

http://unity3d.com/support/documentation/ScriptReference/ForceMode.html

more ▼

asked Sep 28 '10 at 08:51 AM

Jessy gravatar image

Jessy
15.6k 72 95 196

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

FixedUpdate is called every fixed framerate frame.

Update is called every frame.

Because Update is framerate dependent, if your framerate changes (as it likely will) adding forces or making velocity changes may make your object behave inconsistently. FixedUpdate is called at a consistent rate and therefore will behave consistently. As Unity's physics engine does its calculations at a fixed rate in a FixedUpdate, having interim numbers from your changes in Update (calculated using the Time.deltaTime for example) can also result in even more inconsistencies because the changes won't be applied until the physics calculation.

If your changes to physics information are few enough and far enough between, you likely won't notice the difference. There's also the fact that FixedUpdate is usually called less often than Update and this means that you would be doing your calculations less often when that is the case.

more ▼

answered Sep 28 '10 at 07:12 PM

skovacs1 gravatar image

skovacs1
10k 11 25 91

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1866
x494
x292
x244
x74

asked: Sep 28 '10 at 08:51 AM

Seen: 2670 times

Last Updated: Sep 28 '10 at 08:51 AM