|
Whenever I use WorldToViewportPoint/WorldToScreenPoint to place a GUITexture/Texture on a GameObject it always gives two points. One point is on the the GameObject and the other is on the mirror location of the GameObject across the Z-axis(Example (1,1,1)(1,1,-1)). So when the camera turns around the mirrored-Texture is floating over empty space. This can be simply solved by adding if(Z-axis>0){}, but in this situation it won't. I'm tagging an enemy and clamping the position of the texture to the screen. So when the Z-axis is negative the texture becomes static until the Z-axis becomes positive again. Which isn't exactly helpful when a player is trying to find the enemy. So my question is, is there anyway to fix the two point issue? P.S. - I've also tried Mathf.Abs(Z-axis), but that does not fix the issue.
(comments are locked)
|
|
http://www.unifycommunity.com/wiki/index.php?title=ObjectLabel
This turned out to be the answer. If you take the GameObject's position straight from the world it will give two on camera points(front,behind). In-versing the GameObject's position and then applying a reference to the camera with TransformPoint filters out the the phantom point.
(comments are locked)
|

If we could see your code, we might be able to help you further. I've never had what you describe happen, so I don't think it is a feature of WorldToScreenPoint...