I'm trying to build an artillery piece in a video game, how would I find out what angle I need to shoot the artillery to hit a point?

28 Views Asked by At

In this game I am trying to build an artillery piece that can hit points on the map.

I have access to

My location (X,Y,Z) - Target's location (X,Y,Z) - Target's distance

Assuming its at the same Y, the artillery can hit something 1000 "blocks" away when aimed at a 45 degree angle.

Let's say I'm at 0,0,0, and I want to hit an enemy at 500,0,500, what would I have to do to figure out the angle I need to aim at in order to hit the target?

If I am missing information or if my question makes no sense please let me know!