A way to kill rotation made by rigid body pysics?

I made a simple script that checks if the NPC has line of sight with the player when it enters a trigger and it works great my problem is that as soon as the NPC gets any kind of force applied to it it goes into an uncontrollable spin. Is there a way to stop this from happening aside from removing the rigid body?

You can set rigidbody.freezeRotation to true. It’s advisable when you use a rigidbody character, or a CharacterController with a rigidbody attached. This doesn’t disallow rotations, only prevents physics from control them.