Make GUItext appear on screen at location of collision

My camera has a width of 10, ranging from -5 to 5 on the x axis in the scene view, and in-game my player can move from -5 to 5 on the x axis and collide with objects. When the player collides with certain objects I’d like some GUItext to appear on-screen at the position of that collision displaying a number. GUItext’s X-axis values range from 0 to 1, however, so instantiating the GUItext with a position of gameobject.transform.position from the collision does not display the text where I would like on the in-game screen.

I have a feeling that I’m going to have to figure out the math to translate my in-scene -5 to 5 x-axis to 0 to 1 for the GUItext, but is there a way that I can easily do this?

GUITexts live in Viewport space. Your objects in World space. To convert between the two, you can use Camera.WorldToViewportPoint(). Something like:

 theText.position = Camera.main.WorldToScreenPoint(hit.point);