I am trying to create a self aiming cannon, that depending on the x and y coordinates of the target, would determine the perfect angle and velocity.
I have a cannon made from this tutorial: https://www.youtube.com/watch?v=uFr-7At2lXQ
And as a next step for the project I have added a target in front of the cannon like so [pic1]
The problem is I cannot find a decent way to make the cannon itself properly set the values.
I have tried using the Projectile Motion equations from wikipedia, but they do not seem to do the trick at all!
My idea is to get present distance and the height of the target and keep increasing the angle and V, untill the predicted path matches the one of the target.
Does anyone happen to know a decent source I can use for such equations, or how to implement them?
I know this is a noob question, sorry for that. new on the topic.
In the images i present the setup along with the setters and how firing the cannon works