Help with kinematic NPCs following non-Kinematic player and avoiding obstacles

Hi, I want to make some fairies NPCs following the avatar that is controlled by physics using forces. However for the NPCs part I want to control their positions and rotations directly using flocking steering algorithm (Steering Behaviors For Autonomous Characters).

Options:

  1. Set the NPC as kinematic rigid body, and I manually update their positions and rotations by that algorithm, is that possible to still make use of the physics to avoid going into the obstacles for NPC without implementing the collision detection by myself?

  2. Set the NPC as non-Kinematic rigid body as I did for the avatar, and all of them are controlled by physics. In this case, since all I need to input are the forces, is that still possible to make use of the flocking algorithm on the NPC to make it follow the avatar? Plus I don’t want the NPCs to apply any force to the avatar if they can collide.

Thanks!

Hi, welcome to the forum!

A kinematic rigidbody will not react correctly to collisions, while a non-kinematic rigidbody will exert a force on objects it collides with. The best solution here might be to use character controllers for the NPCs. Objects that use these controllers will collide correctly with other objects when they run into them but without applying a force.