smooth transform camera angle

When I click on his button I want to transform the camera angle 90º on the Y.
I’ve been searching the forum and here’s what I put together…
It almost works. it really wants to.
I think its the update function that keeps trying to turn it…

	var target = 270.0;
	var speed = 45.0;
	var someBoolean : boolean = false;

	
	function Update () {
	if (someBoolean == true) {
		var angle : float = Mathf.MoveTowardsAngle
		(transform.eulerAngles.y, target, speed * Time.deltaTime);
		Camera.main.transform.eulerAngles = Vector3(0, angle, 0);   
}     
	}
	
	
	function onmouseDown(){
	someBoolean = true;
	}

Thanks all,

~be

I spot two problems here. The first is that the function is ‘OnMouseDown()’ not ‘onmouseDown’. The second is that if you are going to be turning the camera with this code, you need to also use the camera transform when you callculate the MoveTowardAngle().

#pragma strict 

var target = 270.0;
var speed = 45.0;
var someBoolean : boolean = false;

function Update () {
	if (someBoolean) {
		var angle : float = Mathf.MoveTowardsAngle(Camera.main.transform.eulerAngles.y, target, speed * Time.deltaTime);
		Camera.main.transform.eulerAngles = Vector3(0, angle, 0);   
	}     
}

function OnMouseDown(){
	someBoolean = true;
}

Just to be absolutely clear, this code needs to be attached to a object in the scene that has a collider, and on clicking on that collider, the camera is rotated.