# Working out two lengths when only one length and an angle is known on a right-angled triangle

I'm writing a first person shooter game, and I've got so far. I'm now trying to develop the code that shoots a bullet.

I know what the co-ordinates of A are (this is where the character is standing), and I'm trying to work out what the co-ordinates of F are (the direction of the bullet is length C, I know what this is too) - to do this I need to find out what the lengths of D and E are. I know what angle B is in degrees.

Can anyone please provide me with a formula that can fill the gaps in (D and E)?

A = Where character is stood (I know the co-ordinates)
B = Angle (I know the angle)
C = Direction of bullet (I know the length)
D = I don't know this
E = I don't know this
F = I need to know D and E to find out what these co-ordinates are

-
 You know angle $B$, so you know that the slope of the segment of length C is $\tan(90^\circ-B)$. You know $A$'s coordinates, so building the equation of the line joining $A$ and $F$ should be a snap, after which the coordinates of $F$ can be obtained rather easily... – J. M. May 12 '12 at 15:28 Alternatively: if you have the coordinates $(p,q)$ of $A$, then the parametric equations \begin{align*}x&=p+t\cos(90^\circ-B)\\y&=q+t\sin(90^\circ-B)\end{align*} ought to be of use, and then consider what happens if you replace $t$ with the length of segment $C$... – J. M. May 12 '12 at 15:30

We know that $$D = C \cos \angle B$$ $$E = C \sin \angle B$$ (You can verify these in any introduction to trigonometry.) I trust you can find the coordinates of $F$ from these.