Rigidbody.velocity

I have two questions:
First, why do we need to set the enemy as Kinematic and not dynamic as long as we still moving it using the rigidbody.velocity.

Second, I read in many locations by unity developers that we need to avoid moving game objects using velocity and the better way is using Force and its not clear for me when to use each one?

Hi!

Setting the enemy as kinematic makes the game far less taxing, and if the enemy isn’t using gravity there’s no need to set it as dynamic, but of course, that depends on what exactly you are trying to achieve with your enemies, if you want them to fall or fully interact with the physics engine, then by all means set them as dynamic.

The velocity thing is kinda weird, I’ve read what you say, it is even in the documentation, but even Unity’s official tutorials modify the velocity directly, so… when and why you should or shouldn’t do that, in my experience, it all comes down to what you are trying to achieve and what kind of effect you want.

An example would be a slippery floor, that’s gonna be kinda hard to achieve if you modify the speed directly because the character will stop completely when there’s no input, on the other hand adding a force might cause some hilarious bugs like reaching mach 2 speed because, obviously, its additive, so if your character is already moving fast prepare to see it move even faster. So it’s up to you and your project.

2 Likes

Thanks much,

That was very helpful

1 Like

Privacy & Terms