- Home /
Question by
oinkoinkflapflap · Jun 18, 2011 at 03:27 PM ·
lookatlookrotationy-axislookattarget
how to get my look at script to only work on the Y axis?
i'm using this script;
var LookAtTarget:Transform;
var damp = 6.0;
var savedTime=0;
function Update ()
{
if(LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
var seconds : int = Time.time;
var oddeven = (seconds % 2);
}
}
and i want for it to only work on the Y axis not X and Z....
thanks for your time!
Comment
Answer by Jesse Anders · Jun 18, 2011 at 03:34 PM
This is a 'frequently asked question' :) A search for 'look at y only' turns up (among others), this thread, which should give you the answer you're looking for.