Как подписать объект в 3Д пространстве
public Texture2D texture;
public Transform target;
public Camera camera;
public void OnGUI()
{
Vector3 screenPos = camera.WorldToScreenPoint (target.position);
if (screenPos.z > 0)
{
GUI.DrawTexture(new Rect(screenPos.x-25 ,camera.GetScreenHeight()-screenPos.y-25 ,50,50), texture,ScaleMode.ScaleToFit,true);
GUIStyle s = new GUIStyle();
s.alignment = TextAnchor.UpperCenter;
GUI.Label(new Rect(screenPos.x-50 ,camera.GetScreenHeight()-screenPos.y-30, 100,25), "Sphere1",s );
}
}
Комментариев нет:
Отправить комментарий