hello everyone, I am trying to do a targeting system that targets an object when you click on it and then it adds a GUI image to signal its location. its all working great yet there is a problem where the GUI texture appears both on the target and in its opposite direction (so if the GUI texture centered when you are facing an objetc, when you turn 180 deg you will see the GUI texture). I tried the following to fix the problem yet it did not work:
if (target != null){
GUI.Box(new Rect(10, 10, 150, 30), "TARGET:" + target.name);
GUI.Box(new Rect(10, 50, 150, 30), "DIST. TO TARGET:" + distToTarget);
//here is where it draws the texture(what is in the if statement is what i tried)
if ((target.position.x - transform.position.x) * Mathf.Sin(transform.eulerAngles.y) > 0 ||
(target.position.y - transform.position.y) * Mathf.Cos(transform.eulerAngles.y) > 0)
GUI.DrawTexture(new Rect(targetScreenPos.x - imageScale.x / 2, Screen.height - targetScreenPos.y - imageScale.x / 2
, imageScale.x, imageScale.y), guiImageTexture, ScaleMode.ScaleToFit, true);
}
so long storry short, all i got is the GUI texture to blink. thanks a lot in advanced.