# How to find the angle of reflection given 2 points and a mirror?

I'm pretty new to the Mathematics section of StackExchange and need some guidance on some math for a 2d topdown game I am making. In my game there is an Archer boss, who can shoot reflective arrows, which reflect on the walls similar to light i.e. the angle of incidence is the angle of reflection. In order to make the boss smart I want to add a system which shoots an arrow to the wall which reflects to the player. All I need is to find the angle to shoot at so that it reflects to the player (i.e. angle A in the figure). The actual angle I need refers to angle relative to a line drawn from the player towards the top of the stage, the angles increase clockwise (so 0 deg is top, 90 deg is right, 270 is left etc). This is not needed as I can adjust.

What is given for the function is the boss' and player's coordinates and their height towards the nearest wall (Remember that this is a 2d topdown game therefore height towards wall is the shortest distance towards the wall). Using these parameters how to find angle A in the figure?

Just reflect $$B$$ in the mirror to get a point $$B'$$ lying in the shaded area of the diagram. Now draw a straight line from $$A$$ to $$B'$$. Where this line crosses the plane of the mirror is your point $$C$$.
• This was also going to be my answer. The question has some rather strange requirements--we know the distances $AD$ and $BE$ but do not have access to the location or angle of the wall?--which could make finding $B'$ non-trivial (and even not uniquely determined!). In practice I suspect the question as stated is too specific, and the location of $E$ (and therefore also $B'$) would easily be found using information available to the programmer. – David K Jun 11 at 13:28