Need help modifying mouse look script

alt text

I need to use a mouselook script to rotate a plane from it’s central point (Cube_1).
The standard Mouselook Script that comes with unity wont work for me and i can’t figure out what i need to change in order for it to work like in the pic below. Can someone please help me out with this.

If you want to limit the angles, it’s better to use eulerAngles: save the initial Euler angles at Start, then “rotate” them mathematically in Update according to the controls, assigning the result to the actual object Euler angles:

var maxAngle: float = 15;
var sensitivity: float = 10;
private var angles: Vector3;
private var iniAngles: Vector3;

function Start(){
  // save initial angles in angles and iniAngles:
  iniAngles = angles = transform.eulerAngles;

function Update(){
  // rotate the angles mathematically with the mouse:
  angles.z += Input.GetAxis("Mouse X") * sensitivity;
  angles.x += Input.GetAxis("Mouse Y") * sensitivity;
  // clamp the angles to the limits:
  angles.z = Mathf.Clamp(angles.z, iniAngles.z-maxAngle, iniAngles.z+maxAngle);
  angles.x = Mathf.Clamp(angles.x, iniAngles.x-maxAngle, iniAngles.x+maxAngle);
  // apply the angles to the actual rotation:
  transform.eulerAngles = angles;

If you need a different pivot, place an empty object at the pivot position and child the plane to it - but in this case the script above must be attached to the empty object, not to the plane!