TITLE: Calculate point, given x, y, angle, and distance
QUESTION [50 upvotes]: Excuse my ignorance and use of incorrect terms, but...
I have x and y coordinates, and the angle that the entity is facing on a 2D plane.  I want to find the correct point, say 5 units in front of the point I have.
Examples:
If my entity is at 0, 0 and is facing east (0 degrees), my point would be 5, 0.

If my entity is at 0, 0 and is facing north (90 degrees), my point would be 0, 5.

If my entity is at 0, 0 and is facing north-east (45 degrees), my point would be ???.

I can't even figure it out in my head, let alone figure out the formula I need.  I assume I need trigonometry, but I'm old and haven't used it since 1997.

REPLY [18 votes]: If you are at point (x,y) and you want to move d unit in alpha angle (in radian), then formula for destination point will be:
xx = x + (d * cos(alpha))
yy = y + (d * sin(alpha))

Note: If angle is given in degree:
angle in radian = angle in degree * Pi / 180