How do I code an OnHit-Scrip for my player which makes him reset his position on collision with Objects?

So basically, how can I code a script in c# that resets my players position to the starting point after a collision with an object that has the tag “Obstacle” ? I want it to reset upon Collision with a spinning capsule for example thats tagged “Obstacle”. How can I implement that?

Thanks in advance guys I know this might be very basic but I am just getting started.

Greetings from Austria

OnCollisionEnter or OnCollisionEnter2D if its a 2D game. It takes in a collider and to see if it hit a gameobject with the tag obstacle you do if(collision.tag == “Obstacle”) then to set player position do transform.position = new Vector3(resetposition.x, resetposition.y, resetposition.z);