- Home /
Target box displaying wrong
Hi guys, I have a very simple script that draws a "target box" on screen (and the box bounds an object like an enemy). I was aware that a target behind the player shares the same screen coordinate of a target ahead and I solved the issue just by adding if (enemyShip.renderer.isVisible) and everything works. Kinda.
Now the problem is that if the enemy ship is behind the player and between the player and the sun (directional light), the target box appears in front of me (even tho the enemyShip.renderer is NOT visible). This problem happens only when the enemy, the player and the sun are on the same "line".
Usual behaviour:
Weird behaviour:
I actually have no idea why it acts like this. Any suggestions? Thanks in advance ;)
Answer by isfrseirra259 · Oct 17, 2014 at 06:51 AM
My suggestion would be to simply move the directional light. Since it shines in a uniform direction, from an infinitely far away point, you can simply move the directional light object either far to the left or right of your scene, or move it above the scene.
Unless your problem is that if your directional light, enemy and player are all in the one parallel plane/line. Then, I'm not sure what to do.
Your answer
Follow this Question
Related Questions
full screen wide GUI.Box 3 Answers
Resizable GUI box how to? 1 Answer
How to disable the keyboard text box on Android? 0 Answers
Drawing a GUI box by specifying the two corners 1 Answer
Draw Rectangle 0 Answers