How can i get something to look at something but just on one axis, such as the y axis, so the object is always looking at an object but never looking up or down, just left and right, always following the object. I tried this code and it didnt work:
var PlayerObj : Transform;
function Update () {
transform.rotation.y.LookAt(PlayerObj);
}
You could try to make 2 vector3’s with the same x and z position and than use the LookAt function on Quaternion. Than it will rotate on only the y axis. Or you could make a new quaternion, set it equal to the current rotation, then rotate the object and reset everything in the wuaternion exept for the y rotation. Only problem is, quaterions are realy difficult to understand so if you use the second method, and you run into a problem, try the first
Hope this helps!