Camera return to initial position

Hi,

I have a camera script, which moves with the mouse around a car. It also follows the car.
However the camera stays at the position of the mouse. If the mouse is at the center of the screen, then only the car is properly visible, and is suitable for driving.

I want the camera to return back to it’s position (behind the car) after some time if it’s somewhere else.

The camera is the child of the car. How can I do this?

If your camera starts of viewing from the back, then create a global variable resetPos and set it in Start. Then when you move about, you have the location saved and just reference it back when you like as such transform.position = resetPos.

If you don’t have it starting from the back, simplest way would be to make a empty game object and place it behind the car and just reference that instead. Make sure to parent it to the parent of the car object.