So, been up all night working on getting the velocity/angle of arrow simulations perfect. Running into an issue with the physics engine I'm using is ever so slightly off (probably a rounding issue)

The Velocity is a fixed 55 "Units"

Correction Required at ranges (Range being the variable):

Range | Correction
30      0.0180
100     0.0055
200     0.0027
300     0.00165

After applying manual corrections on the velocity, I've been able to come up with the above data set.

Would anyone be so kind as to help me figure out a formula which satisfies the above problem?

Minor Background Information

The formulas I am using for the base calculations are https://en.wikipedia.org/wiki/Trajectory_of_a_projectile

  • $\begingroup$ You could try to make your time-steps $dt$ smaller to give a better resolution. But perhaps the most practical solution is to obtain more data and make a fit. $\endgroup$ – Bobson Dugnutt Feb 7 '16 at 8:59
  • $\begingroup$ I can supply more data points, but formulating equations has never been my strong suite. That's why after 17hours of straight programming I have to admit defeat and ask for help $\endgroup$ – Riaan Walters Feb 7 '16 at 9:00
  • $\begingroup$ Using an in-built fit function in some software you can get your hands on doesn't require any formulation of eq.s. $\endgroup$ – Bobson Dugnutt Feb 7 '16 at 9:02
  • $\begingroup$ Also, these corrections are on the order of 0.005 % or lower of the expected value. This really isn't a problem, especially since these corrections get lower with distance - it would be another thing if there were some error that built up over time. But really, I think your simulation is doing just fine without any correction whatsoever. $\endgroup$ – Bobson Dugnutt Feb 7 '16 at 9:05
  • $\begingroup$ The arrows are missing the target by ~40cm over 300 meters, this unfortunately is not "doing fine" :) This is a 0.0013 miscalculation but it is enough for the users to notice it, sadly $\endgroup$ – Riaan Walters Feb 7 '16 at 9:07

Inspired by Frentos's answer, for the time being, let us assume something like $$y=\frac ax+b$$ Using your values, a simple linear regression gives $$y=\frac{0.541976}{x}-0.000038024$$ which gives as predicted corrections $0.01803$, $0.00538$, $0.00267$, $0.00177$.

As said, with more data points, something better could come out.


Take care; the constant term is not significant. So, $y=\frac{0.540401}{x}$ seems to more than sufficient (predicted values $0.01801$, $0.00540$, $0.00270$, $0.00180$)

  • $\begingroup$ After moddifying it ever so slightly it came to be $$y=\frac{0.541976}{x}-0.000149024024$$ With these magic numbers, at 30m it misses by 2mm and 300m it misses by 9mm, which is very much acceptable, Thank you for the pointers $\endgroup$ – Riaan Walters Feb 7 '16 at 11:58

As per comments, it's difficult to make a model of the error without more knowledge of the your script.

The first three data points fit an almost perfect inverse relationship:

 30 * 0.0180  = 0.54
100 * 0.0055  = 0.55
200 * 0.0027  = 0.54
300 * 0.00165 = 0.495

The fact that the $300$ range datapoint doesn't fit suggests something more complex is going on, but without more information about the script or more datapoints it's hard to come up with anything substantial.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.