New coordinates using angle and distance
I want to move an actor to a new location.
The new location is determined with a variable angle and a variable distance. I essentially have: an angle, a hypotenuse, and a starting location. Is there a way to work out the new coordinates for the actor to move to?
A bit more detail - I'm trying to create a basic AI for the actor (defender) to intercept a ball being passed. I'm first setting a random distance between the defender and the ball (the hypotenuse). The angle will then be set according to the direction the ball is going. The 'stronger' the AI of the defender, the closer the defender's angle will match that of the ball. And so... if the AI is 'perfect' it will have the same angle as the ball and will result in the defender moving to a position on the line that the ball will travel.
Open to any suggestions on how to set this up!
Thanks,
James
Comments
x = hypotenuse
*
cos(angle)+starting location xY = hypotenuse
*
sin(angle)+starting location y