I'm trying to find the angle/direction to get from point A to B in a (rectangular) field. It is possible to bounce the ball on the sides of the field. I would like to find out what the correct starting angle would be to get it from the starting point to the end point with an x amount of bounces.
Quite simply, im trying to derive an algorithm that allows me to put in the start and end positions (as vec2's, since its a 2D scenario) as well as the amount of bounces i would like to use to get from point A to B, the output should be the angle/direction i would have to use to execute this. Additionally it should be possible to test this in both directions (first shooting left or right from the starting point).
If anyone has any suggestions on how to do this, i'd be happy to hear it.