Npc flies away when player hits them

When a npc is moving (this only happens when moving), and the player runs into them, the npc will be knocked back many meters. Note the player has a character controller, and the npc has a rigidbody.

After researching, one possible origin of this issue is when a rigidbodies velocity is manipulated manually, instead of applying forces. Does astar do this?

Regardless, is this a known issue with a known solution?


This happens because the npc has a non-kinematic rigidbody. You should make it a kinematic rigidbody (or just use a character controller).

Hmm this results in npcs not colliding with objects, something I’m not too sure about. Is there no way to get both “not flying away” and also “colliding with walls / objects”?

Looking at AIBase, it looks like the code uses MovePosition to move the rigidbody. This is what is causing the fly away, correct? Is it possible to use velocity instead if the rigidbody is non-kinetic?

EDIT: I just decided to use a charactercontroller, and it works out fine. I had to make a custom “applyforce” logic, but it works out in the end :))

Never mind, I’d really like to avoid using characterController - it’s causing a large number of issues, since character controllers aren’t really colliders at all. So I’m still wondering if there is any possible solution…

Hate to bump, but I’m still having issues with this :S