I have this script
but I only want the object to rotate on the Y-Axis can someone help?
asked Dec 01 '11 at 10:09 PM
Calculate the direction vector and zero its y component - this makes the direction strictly horizontal:
var dir = target.position - transform.position; dir.y = 0; // kill height differences transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(dir), rotationSpeed * Time.deltaTime);
answered Dec 01 '11 at 10:24 PM