Show Enemy Indicator on Horizon
So I have this little game where I walk across a planet and shoot things (of course).
The red triangles on the side are off-screen enemy indicators, showing me enemies that are near my back. I used Camera.WorldToViewportPoint to help me determine the location of the enemies in 2D screen space.
Now I'd like to place some indicators right over the horizon, to show me that there are enemies in front of me that I can't see now, because of the curvature of the planet.
I simply can't figure out a way how to do this. Maybe create a plane that runs from the camera over the sphere tangentially, then draw a ray from the enemy in upwards direction (relative to the player) and see where it hits the plane.
Any ideas on this?
Answer by Linke Seitentasche · Feb 20, 2016 at 12:08 AM
I solved it, see this forum post: http://forum.unity3d.com/threads/show-enemy-indicator-on-horizon.385994/#post-2518522