Hello!
My Problem is, that I would like to create a GUIText when I press the “e” key. But it should only create a text if I look on the specific object. For example if I look on the rock which should “say” something and I press “e” then it should create the GUIText.
I hope you understand what I mean.
Greetings
Looking at how? Top-down, isometric, 3D view? In 3D graphics, you use the dot product of two vectors to determine how much those vectors are facing in the same direction. In this case, you’d get the dot product between your camera’s facing direction and the the difference between the object’s position and the camera position. Make sure you allow for a tolerance in the angle.
The documentation has an example: http://unity3d.com/support/documentation/ScriptReference/Vector3.Dot.html