F=ma
rigidbody.AddForce();
If I apply a force to an object, how long does the force have been applied? If it is applied for only a moment, the object should not move. What does the force in unity mean?
Depends on which ForceMode you use:
In general the result of AddForce is a change in velocity (AKA acceleration). Remember Unity uses a discrete-timestep physics simulation, where 1 timestep == Time.fixedDeltaTime seconds. If F
is the applied force vector, then, for a single call of AddForce:
Force (default mode) - The change in velocity is equal to F * Time.fixedDeltaTime / mass
Acceleration - The change in velocity is equal to F * Time.fixedDeltaTime
Impulse - The change in velocity is equal to F / mass
VelocityChange - The change in velocity is equal to F
There can be torques applied as well if the force is not applied at the center of mass.
That’s not really correct. You should multiply by fixedDeltaTime, not dividing. See my answer over here.
Ah you’re right! My mistake . Edited my post.
They all change your velocity, as a 1-time thing. No matter what mode rb.AddForce(…) uses it instantly changes the object’s speed, and does nothing else. It will stay at that speed, since it just will (but gravity and friction will still work).
The modes are for if you want to think of it as force and not speed-change. Technically force has to be divided by mass and applied over time, but in a game with frames, it doesn’t.