ballistic-solver is a point-mass intercept solver for games, simulation,
robotics, and research. It is deliberately scoped, and the assumptions below are
part of that scope rather than bugs. Knowing them up front is the best way to
decide whether it fits your use case.
- Point mass only. The projectile is a point with no orientation, no rigid- body dynamics, and no lift. There is no spin drift / Magnus effect.
- Quadratic drag with a single scalar coefficient
kDrag. There is no Mach-dependent drag table and no per-segment drag curve; transonic/supersonic rounds whoseCdvaries strongly with speed are not modelled accurately. - Constant gravity. No altitude variation, no Coriolis term.
- Uniform, constant wind. Wind is a single air-velocity vector; there is no gust, shear, or altitude profile.
- Air density is folded into
kDragand is constant for the flight; it does not vary with altitude during the trajectory.
- Two unknowns: launch angles
(θ, φ)only. Muzzle speedv0is an input, not solved for; the solver does not pick a charge/speed to make a target reachable. - Target motion is constant-velocity or constant-acceleration (or whatever a
user-supplied predictor returns via
solve_predicted). A freely maneuvering target is only handled to the extent the predictor models it. - One arc branch at a time. With
arcModefixed, the solver finds a solution on that branch; a solution that exists only on the other branch is not returned unless you switcharcMode. - No terrain or obstacle collision. Trajectories are not clipped against ground or geometry; an angle that "hits" may pass through terrain in your world.
- Fixed-step RK4. Accuracy depends on
dt,tMax, andtolMiss. Too large adtor too short atMaxcan miss or fail to converge. - Best-effort, not guaranteed. For unreachable or near-limit targets the
solver returns its closest iterate with
success = false; it does not prove that no solution exists. - Your runtime must match the solver's physics. If the consuming engine integrates with a different scheme or timestep, the computed angles may not hit even when the solver reports success. See the "Solver validity note" in the README.
This is a numerical library for simulated and robotic targeting and for research. It is not a certified or safety-rated fire-control system and is not intended for use as one.