AddRelativeForce vs AddForceAtPosition

Why is this:
_rigidbody.AddRelativeForce(Vector3.right * wheelSlip * Time.fixedDeltaTime, ForceMode.Force);

… and this:
_rigidbody.AddForceAtPosition(_rigidbody.transform.TransformDirection(Vector3.right) * wheelSlip * Time.fixedDeltaTime, _rigidbody.transform.position, ForceMode.Force);

… not the same? Second one is more “slippery.”

wheelSlip is a float.

  • There is a good chance that the center of mass (Rigidbody.worldCenterOfMass) and the transform position are not the same. Applying a force anywhere but the center of mass will usually cause the rigidbody to rotate. Try using AddForce() if you intend to apply the force without changing its angular velocity.

  • When working with rigidbodies, it is best to use the rigidbody’s position instead of the transform’s position, as they may not be the same. For example, setting the rigidbody’s position might not immediately update the transform’s position, and vice versa. I’m not entirely sure when they are synced. This is much more of an issue when working in non-FixedUpdate, as the transform is moved every frame if you use interpolation/extrapolation, and the rigidbody only updates on every fixed update schedule. The same applies for rotations.

Also, note that using Time.fixedDeltaTime is wrong. You should remove it from the calculations. Forces are specified in Newtons (N) and are time-independent magnitudes in that context.