Simple Quaternion.Slerp question

Hi. I have an object (turret) and i want it to look to the player. so i have this script:

var target : Transform;
function Update ()
{
	var targetPoint = target.position;
	var targetRotation = Quaternion.LookRotation (targetPoint - transform.position, Vector3.up);
	transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);
}

but, i want it to only rotate Y…
how do i do that?

Try this:

var target : Transform;
function Update ()
{
	var targetPoint = target.position;
	var aimVector = targetPoint - transform.position;
	aimVector.y = 0;
	var targetRotation = Quaternion.LookRotation (aimVector, Vector3.up);
	transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);
}

Untested, but I expect it will work :wink:

it woked, thankyou =]