hi everybody, i want to inverse the float value screenPosition.x
form this GUI.Label(new Rect(screenPosition.x,Screen.height-50,100,20), Name);
the whole script:
var Name : String;
var font : Font;
var col : Color;
function Start()
{
}
function Update ()
{
}
function OnGUI()
{
screenPosition = Camera.main.WorldToScreenPoint(Vector3(transform.position.x-0.2, transform.position.y+1, transform.position.z));
screenPosition.x = Mathf.Clamp(screenPosition.x, 20, Screen.width-75);
screenPosition.y = Screen.height - screenPosition.y;
screenPosition.y = Mathf.Clamp(screenPosition.y, 50, Screen.height);
GUI.skin.font = font;
GUI.color = col;
var infront = transform.position - Camera.main.transform.position;
if (Vector3.Dot(Camera.main.transform.forward, infront) > 0)
{
GUI.Label(new Rect(screenPosition.x-10,screenPosition.y-40,100,20), Name);
}
else
{
GUI.Label(new Rect(screenPosition.x,Screen.height-50,100,20), Name);
}
}
thank you