Make the Camera go back to an initial point.

I started using Unity3D a few days ago. I don’t know any programming language, that’s why i am in some trouble.
I was working on a Over-the-shoulder camera (with an empty and target behind the shoulder) and I managed to make a little script to do so, but it had issues, then I borrowed the one I found in a Statement’s post.

Well, the problem I have now is that I would like my camera to go back to its initial point (I mean behind my character’s shoulder), but I have no idea how to figure it out. So, I’m asking for some help in here.

Here is the camera control code :

function Start () {


var speed = 10.0f;
function Update()
    var movement =;
    movement.y = Input.GetAxis("RightV");
    movement.x = Input.GetAxis("RightH");
    transform.Translate(movement * speed * Time.deltaTime, Space.Self);

In the ideal, I’d also like this camera to be restrained. I mean, if I could prevent it from rotating over a certain point, it would be the best. Any suggestion?

Thanks in advance.


I think you should simply create a private transform which would store the initial position and rotation of your camera, something like this :

//get your initial position and rot
var initialPosRot : transform;

initialPosRot.position = transform.position;
initialPosRot.rotation = transform.rotation;

// and then apply it when needed

transform.position = initialPosRot.position;
transform.rotation = initialPosRot.rotation;

Please take a look at one of the third person tutorials on the Unity homepage. You will learn a lot, not only concerning getting to learn the Editor, but also particular problems like yours concerning camera steering and constraining.