I am working on a 2.5D game. i am using this script to rotate the hand around the player and point at the aiming reticule. this works perfectly when i move the reticule in a counter clockwise direction around the player however if i stop moving the reticule or move it in a clockwise direction the “hand” will flip out and begin to spin around the player. I have ensured the player, reticule, and hand are all aligned on the z plane.
public var trgt : Transform;
public var player : Transform;
function Start () {
}
function Update () {
transform.RotateAround(player.position,Vector3(0,0,1),Vector3.Angle(transform.position,trgt.position));
Debug.Log(Vector3.Angle(transform.position,trgt.position));
Debug.DrawLine(transform.position,trgt.position,Color.white,0,false);
Debug.DrawLine(player.position,trgt.position,Color.white,0,false);
}
any suggestions are welcome