I'm trying to guide the player to the last enemy on the field, via having an icon on the edge of the screen pointing towards the last enemy outside the screen.
The screen is the rectangle, the player is the point within the rectangle, and the enemy is the point outside of the rectangle.
The solutions I can think of are finding which side will be intersected (Which I'm not sure how to do correctly, but I imagine first involves finding if it will be intersecting on vertical or horizontal sides) and then using a linear equation to find the x or y. Or, you could use a line-line-intersection method on each side, but as the screen rect never changes, this seems a little overkill.
I've got my first solution working on paper for one test case, but can't get it working at all with in Unity.
Does anyone have a solution or could push me in the right direction? Thanks a lot.