Is it even necessary to multiply by Time.deltatime in fixedupdate

if im using addforce(#) do i have to make it addforce(# * time.deltatime)…
I tried both ways and i get the same results except for the time.deltatime version i have to multiply by like 50 to get the same results as without it.

Im thinking since its in fixed update anyway then its not necessary. I got a confirmation here:

bangalirussian 1 week ago

Hmm do you really need to multiply by Time.deltatime in addforce if its in fixedupdate anyway?
·
Adam Buckner

Adam Buckner 1 hour ago

No - this will be corrected
· in reply to bangalirussian

but im looking for a second opinion.

Don’t multiply the force by Time.deltaTime: AddForce already applies the force during a single physics cycle in its default mode (ForceMode.Force), thus multiplying it by Time.deltaTime will actually result in a force 50 times smaller (there are 50 physics cycles per second, thus Time.deltaTime is 1/50).

AddForce already multiplies by Time.deltaTime. AddForce is a simplified system so you don’t have to use or think about deltaTime (or mass.)

“For real,” if you want to get something rolling 10 meters/sec north, you say rigidbody.velocity+=Vector3.forward*10;. That’s the same thing as rigidbody.AddForce(Vector3.forward*10, ForceMode.VelocityChange);.

Say instead you want to hold down a thruster and accelerate by 10m/s/s. Now you need T.dt: rb.vel+=Vector3.forward*10*Time.deltaTime;, to shove yourself 1/50th of the amount each frame. That’s the same as AddForce( ... *10 , ForceMode.Force);. There’s an invisible *Time.deltaTime hidden in there when you type FM.Force.

The reason is, some perfectly nice people are not comfortable with +=, technical terms like velocity, and how times 0.02 is the same as divide by 50. They are OK with the rule “use ForceMode.Force if you run it every frame; ForceMode.Impulse for a 1-time thing.”

The docs don’t tell you that ForceMode.Force divides by the framerate, since that would defeat the purpose (keeping AddForce simple, by avoiding all talk of math and framerates.) Now, why is AddForce with only one input the "do this every frame; auto multiply by Time.deltaTime` version? They probably assumed the most common use would be every frame.

Your AddForce is the force added at that frame. If you are in a fixed update of, say, 0,033sec (30 fps) and you have 10 as the added value, you will have 300 force added per second. The fact that you multiply by Time.deltatime is useless!

The reason why you would do so in the Update() function is that the deltatime will not be always the same so you have to make sure to multiply it by the deltatime to have always the same value per second added.

Physics engine react weirdly with not fixed delta time, so this is why it’s a good idea to put the addForce in the FixedUpdate function.

Basically, multiplying the value by Time.deltatime will DEFEAT the purpose of you adding it in the FixedUpdate function!

Right now it probably work both ways because you probably have a steady frame rate. Things will go wrong if you it some down time in your game (which is probably bound to happen at some point).

So short story : Do NOT multiply by Time.deltatime!

:slight_smile: