How do I make it so that a gameobject can not be moved by the player?

Right now I am making an enemy and I realize that it can be easy be pushed around by the player. So I wonder how do I make it so the enemy (gameobject) can not be pushed around by the player and be able to move around freely using rb.velocity.

Lock the x, y and z directions on the RigidBody.

I made some improvements to my current system and I fixed a bug that made my enemy freeze up time to time, I used transform.translate which help out with the stuck part.