i have 2 gameobject “TanHead” and plane(with position increment in x ) ,what i want is my TanHead to follow plane with only rotation ,position of Tank is fixed .so when my gameobject (plane) is above Tank the rotation on TanHead will be 270 degree. i have looked and tried lookat function but i cant use that because i want to fix tank rotation upto 0 to 90 degree
here is my my image [24308-start+.png|24308]
here is what it should look like when my plane goes by
now what m using for rotation
var target : Transform;
var myself:Transform;
var tempAngle:float;
private var angle: Vector3 = new Vector3(360,270,0);
@script AddComponentMenu("Camera-Control/Smooth Look At")
function LateUpdate()
{
myself.LookAt(target);
if(myself.transform.rotation.x != 0)
//seem to get a 0 if my target is in
//certain places because I am using a mouse pos and hit with plane.
{
tempAngle = myself.transform.rotation.x * 100; //don't know how to read a euler
//angle into a float so I just multiplied by 100 to get the angle.
}
else
{
tempAngle = tempAngle;
}
myself.rotation = Quaternion.Euler(tempAngle,270,0);
}
what i can do to fix it because with this script when my plane goes to 270 degree it direct it self to 360 degree causing big jerk thank you