Jump to content
Sign in to follow this  
CTI player IF

Ballistic of Bullet/Shell in OFP

Recommended Posts

Introduction and Acknowledgment

    It is the player @hitman1987 and his work on the mod @Reforger that inspire the author with the idea about equation of motion in OFP. $hitman sent the author messages introducing his purpose and achievement in January, including his result of realistic ballistics, which relates to the main content of this topic. On last Saturday, April 18th, 2020, the author happened to have a thought about how projectiles fly in OFP after having read some CONFIG files of @Reforger.

    The @Reforger also displays some weapons with graduations to the author. It is the first time that the author come into contact with this kinda design. The author wish to add "Artillery Support" in CTI, not in the form of "creating shells by scripts" but by directly shooting. This requiring both trajectory's calculation and graduations displaying, and the products in @Reforger delightfully meets the author's needs.

    The author builds correct motion equations of "shotBullet" and "shotShell" and gives precise numerical solution (alright, numerical solution is given by RK4 formula). Furthermore with the help of the precise numerical solution, the author directly calculates and draws the graduations for specific weapons and vehicles (the main part affecting the trajectory is InitSpeed of magazines, and the length and the initial angle of the gun affect a small part as well). They're planned to be introduced into TZK in next version.

    The author summarizes this topic for $hitman, @Reforger and other OFPers.

Chapter 1

Equations and Solution

    There is an annotation in@Reforger of the airFriction, which is a parameter of CfgAmmo objects and isn't explicitly given by BIN\CONFIG of 1.96/1.99. The annotation says //e.g. a projectile with a muzzle velocity of 1640 m/s which slows down 94 m/s/s (i.e. by 94 m/s in the first second) has an airFriction of: -94/16402 ~= 0.0000035. The 16402 of course should be 1640² and the author was thus inspired that in OFP the friction is thus probably obeying

5sODM4I.gif

    The author once explored the relationship between trajectory and mass of bullet's model when trying to design the global tracer effect. The result is mass don't affect trajectory of those bullets whose simulation is "shotBullet" and "shotShell". Thus the 5sODM4I.gif should degenerate to fkEMQuO.gif, and the coef c might be just the airFriction.

    Consider the Parabolic Motion with gravity. The equation of motion should be

oL3bvcA.gif

here the aygpB9L.gif means the unit vector in the BqFzMa8.gif direction. We divide the vector into horizontal and vertical, and take the up and right as positive direction. Note that the acceleration is the derivative of velocity to time, we gain 2 equations:

oheKZ1O.gif

JW5AEi3.gif

This is ODEs of d1igUns.gif and X7GEW6K.gif, but it hasn't analytical solution. Although it is only first-order, it's nonlinear. Luckly this simple system

7pjgf7F.gif

has a unique solution for f is independent with time. Having calculated its numerical solution, the author compared it with the distance of an actual bullet shot in OFP with a same initial data as equations', and verified that the coef -c (don't miss the negative sign) is exactly the airFriction, and the gravity in OFP is 9.8 (according to subsequent exploration on the ballistic of rocket, the gravity in OFP probably be 9.8066. But simply applying 9.8 won't cause too much error).

 

    There is another implicit parameter coefGravity of CfgAmmo objects. It is just the multiple of g and its default value is 1. No more parameters and terms in the equations imitating wind or other physical quantities.

    It's possible for editors to define coefGravity for specific ammo or all ammo (by modifying the "Default" object of CfgAmmo) in 1.96/1.99. The airFriction, however, can't be modified in 1.96/1.99. Its default value is -0.0005. The 2.01 ArmA:R explicitly defines both of coefGravity and airFriction in its CONFIG, and editors can thus modify airFriction as well. The author tried modifying their value and check whether the distance is still equal to the calculated one. It is safe to define coefGravity from 0 to 100, but a -0.01 value airFriction can cause 10 meters' error of a 380m range ammo. Editors are recommended not to set too big value for airFriction. To be honest, since the equations don't have analytical solution, OFP must use numerical method as well. The author guess the time difference in OFP probably related to the FPS, which will be inaccurate for high airFriction.

0 coefGravity can be applied for some laser weapons, and for some ammo detecting the direction of weapon (the bullet we catch by Fired-EventHandler, with a nonzero coefGravity , has fallen and thus can't represent the direction exactly).

    One more to attention: the airFriction should be a negative value. Not verified, but the positive value probably will be treated as 0 (of course, the air fricton won't help accelerating your bullet).

    About compatibility: it's safe to add new parameter coefGravity for specific ammo in 1.99/1.96, even though it isn't explicitly defined in BIN\CONFIG. The airFriction can't be modified in 1.99/1.96 and must use -0.0005 (one can define airFriction in config but it won't work). Both of them can be modified in 2.01, but be aware that [4RTech] has explicitly defined airFriction and coefGravity in the "Default" object of CfgAmmo of their BIN\CONFIG, editor must not miss airFriction and coefGravity in the BIN\CONFIG of their own mod (this often happen when editors applying their mod direct on 2.01, without modifying their BIN\CONFIG). Otherwise 2.01 game will crash, if using a mod with undefined airFriction and coefGravity BIN\CONFIG, and shooting an ammo with defined airFriction and coefGravity .

 

 

Complete contents is included in a PDF and can be read/downloaded here.

A video displaying its effects of Mortar and Howitzer. In @Reforger players can experience its grenade launcher, the first vehicle that the author has ever seen of this design, and experience some other properties like realistic ballistics, sights zeroing switch, etc.

Edited by CTI player IF
airFriction tested can't be applied in 1.96/1.99
  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Hello,

 

Very interesting to read, thanks. One thing ive been wondering about ofp ballistics is that does the bullet energy or hit value decrease lineary as the bullet slows down. Do my guns bullet do less damage at long range than short? Is that modelled in ofp cwa?

Share this post


Link to post
Share on other sites
14 hours ago, Hupara said:

Hello,

 

Very interesting to read, thanks. One thing ive been wondering about ofp ballistics is that does the bullet energy or hit value decrease lineary as the bullet slows down. Do my guns bullet do less damage at long range than short? Is that modelled in ofp cwa?

Not verified for bullet, but shell's power won't decrease due to long range shooting.

Share this post


Link to post
Share on other sites

Ok. I have to do some testing, but i have a feeling that it is not simulated for bullet either.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×