Rawbots Club Forum
Rawbots General => General Discussion => Topic started by: tob.s on December 07, 2016, 03:52:15 am

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 ;D , 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* timetotarget 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 vpcode 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

That seems to be working very well now.
If you think there are rounding errors in there somewhere, it would be interesting to compere the accuracy with the turrets built before XFM added inverse trig functions. They used an integrator with the projected trajectory calculations in the feedback path to home in on the best firing solution. That might have some inherent error cancellation or bigger numbers that are less affected by rounding.
We really need some bigger maps for ACL so that there's more chance to use snipers/long range artillery like your bot, or missiles and grenade cannons.

It may be because gravity increases as altitude increases on blueshiftbased maps, and the formula assumes constant gravity which will cause it to undershoot.

Yes that changing gravity realy is a problem, i didnt know it increases with altitude on blueshift, this explains why my tries on firing the high arc always ended way to short and also why i had to tweak the projectile speed value to 103.5 instead of the actual 101.2 (shoot force 4000 / 39,5 ) when firing the low arc. It should be possible to calculate the flighpaths highest point and also to calculate the gravity up there. The middle between those two gravity values should do ( atleast aslong as theres no big altitude difference between cannon and target )
edit
just tested this and ended up shooting a bit too far, tested further and it turned out gravity isnt increasing linear  sigh why does it have to be that complicated.