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