Quantcast
Channel: Latest Questions by Tyrebear
Viewing all articles
Browse latest Browse all 30

Isometric Game Labels Not Displaying Correctly

$
0
0
Hey I'm making an isometric game that has customers buying food and preforming different actions. I would like a little speech bubble or image to appear next to them depending on what they are thinking or feeling. The problem is that the camera is set to orthographic so the GUI.Label isn't tracking the position of each customer correctly. It's hard for me to explain so look at the picture. :) ![alt text][1] [1]: /storage/temp/28174-example.png Notice how the labels are sticking to the top of the screen. static var currentWaypointMirror: int; var agent: NavMeshAgent; var script1: SlideOutMenu; var activeWaypoints: Transform[]; var inactiveWaypoints: Transform[]; var masterWaypoints: Transform[]; var startMoving = false; var selectedMenuItem: int; var subtractedBurgers: int; var subtractedGlucks: int; var subtractedBopsters: int; var customerID: int; var chairSet: int; var labelPos : Vector2; var labelSize : Vector2; var customerPos : Vector2; var cameraer : Camera; function Awake() { customerPos = transform.position; customerID++; agent = gameObject.GetComponent. (); agent.speed = Random.Range(2.5, 5); script1 = gameObject.Find("GUIElements").GetComponent(SlideOutMenu); } function OnGUI(){ GUI.Label(Rect(labelPos.x, labelPos.y, labelSize.x, labelSize.y), "Customer"); } function Update() { var labelStuff : Vector3 = cameraer.WorldToScreenPoint(Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z)); labelPos.x = labelStuff.x - labelStuff.y; if(script1.activateWaypointSet[1] == false && script1.activateWaypointSet[5] == false){ WaitForUpgrades(); } ScanForSets(); CheckActiveWaypoints(); TurnOnEntity(); if (startMoving == true) { waypoint = activeWaypoints[currentWaypoint]; agent.SetDestination(waypoint.position); } }

Viewing all articles
Browse latest Browse all 30

Latest Images

Trending Articles





Latest Images