Hi,

to hit something moving, you need to be able to hit a stationary target very precisely first.

i always used rel. simple geometrics to determine the launch angle of my cannons - so they were basicly pointing directly at the target ( with some offsets to counteract gravity for certain ranges ).

This time though i used ballistic calculations to proper include gravity and the result is

, but see yourself.

edit=vd

I linked the target to the cannon, so i could fire it without having to switch between target and cannon, also added some distance- and a *wip* time-to-target -display , targeting is using a camera imput though and isnt connected to any off the other stuff. Everything exept firing is full automatic, the target turns red whenever i press my fire key.

There seems to be a bit of a dead/lower accuracy spot when firing nearly horizontal, i guess its because many of the arc functions deliver values very close to zero - not sure if the "freezing" of any slow moving object also affects this - so in the video im firing short salvos. If the first shot doesnt, the second one hits ( seems like the physics have to be woken by the first shot). Also im currently not compensating the very small differnce between the set angle and the cannons actual pitch, which might also be the cause.

The Values i couldnt calculate are based on experiments and guesswork, so theres still room for improvement.

Next step will be to declutter / nicely arrange the vp-code and then figure out how to hit moving targets.

- edit-

with your help, some value tweaking and also by adding a controler to make sure the cannons pitch is exactly alignend to the calculated launch angle, i nearly doubled range. Now it hits precisely between distances of 50 to 1000. Maximum shooting distance at the given speed and 45° launch angle is around 1250 . However at more than 1000 range, the closer i get to max range, the increasingly earlier the projectiles drop. I tried changing the projectile speed in the calculations but it has no effect, so i guees it may be due to rounding &/ canon alignment errors.

video is being updated