New to Unity, I go through some tutorials. And I noticed something : in a lot of tutorials, when an object is moved with RigidBody.AddForce (or ConstantForce), the value of this force is often multiplicated with the drag, mass, gravity, etc…
Why such a multiplication ? Doesn’t a RigidBody automatically take these values into account when applying the force given in parameter to AddForce() ?
Thanks for lighting me
You should not worry about these “magic tricks” - from my experience, most programmers simply ignore physics basics and create random tricks just to make their projects work.
Unity’s physics engine tries to emulate the real world physics - at least the most important stuff, like gravity, forces, mass, inertia, friction etc. AddForce applies a force to a rigidbody exactly like in real world, which produces an acceleration (a variation in velocity) equals to force / mass. If you multiply the force by the mass, you will get an acceleration equal to force * mass / mass, or just force, what results in an acceleration numerically equal to the force applied - in other words, it applies an acceleration independent of the rigidbody’s mass, exactly like gravity. Conversely, mass * gravity results in the weight force, the force that pushes the rigidbody to the ground - it’s useful to calculate a force that balances the gravity (for baloon physics, for instance), or to create an “artificial gravity”.