Hi, hope I can clear some confusions.
First of all the difference is, rigidbody.velocity changes the velocity in an instant while AddForce applies force on an updated basis based on how you use it.
For example, in real world, when you kick the football, you apply a force to it but, it’s a big force so ball’s Z velocity suddenly becomes let’s say 10. So from 0 it becomes 10 and it moves forward really fast, getting slower in time because of the air drag. Same applies for the drinks a barman tosses on the bar like in the movies.
When you push a very heavy create, you apply force to it constantly because it’s very heavy and it has a bigger mass so it resists the force therefore moves slower. And you add more force constantly to move it somewhere.
When an attack helicopter shoots rockets, those rockets always move with the same speed because they have a constant pushing power behind them, or the space shuttles once they are taking off. So they don’t lose speed. it’s constant force.
So about which works best for which situations as it should be already clear from the above examples,
-Constant force for objects which have their own pushing power like rockets.
-Rigidbody.velocity for objects which have a big starting power then getting slower by drag, like football, thrown hand grenade, arrow etc. (I’ve also used this for making a jump pad. So that when player triggers the jump pad, players Y velocity suddenly becomes 10 so it jumps up getting slower in time)
-AddForce for adding forces constantly, moving objects with force every frame. If you know Marble Blast game, that’s how it works. Based on the player input, you add a force to the marble. So as long as forward button is held down, a force of for example 5 added to it in that direction.
Every physics based operation must be operated under FixedUpdate function. Because that’s where Unity updates the physics on a fixed frame rate so the physics become more accurate. You don’t have to worry about what happens in the low level. Just make sure you put them in that function or things become unstable.
It doesn’t mean it has to happen every frame once you put it under fixedupdate. Thrown objects usually work like this in pseudo code;
If blabla key is pressed
{
Instantiate the thrown object in player hand position
Make it’s Z velocity something like 10
}
So it only happens when the key is pressed, so as soon as the key is pressed, the object gets cloned, and it’s velocity being set, and it doesn’t happen again until you press the key again. And when you press the key again a new object is cloned and it’s velocity is being set…so you never update the same object every physics update.
I hope it will help. Ask anything that’s left unclear.