When my player gameObject collides with another gameObject, I want to keep the player from leaving a small area around this other gameObject until the player has defeated the enemy. In other words restrict the movement of the play until the enemy has been dealt with. I just don't know how to restrict the movement temporarily to a small amount of space local to where the initial collision took place.
I think possible solutions are to clamp the transform, or to create a another gameObject to physically keep the player in this area using rigidbody and a collider.
My player controlled movement right now is simply Input.GetAxis for both vertical and horizontal input and using transform.translate.
Thanks for reading my question. Any help would be appreciated, even something you might think is obvious, I'm still new to this. Thanks a lot.