High-performance ballistics trajectory calculation engine built with Rust. Comprehensive physics modeling, automatic zeroing, FFI bindings, and statistical analysis capabilities.
Everything you need for professional ballistics calculations
Six-state ballistic modeling with RK4 and Euler integration methods for accurate trajectory predictions.
Support for G1, G7, and custom drag curves with automatic transonic corrections.
Calculate sight adjustments and apply zero angles automatically with MOA and mrad outputs.
Seamless switching between Imperial (default) and Metric units for all calculations.
Velocity-dependent ballistic coefficient modeling with automatic estimation.
Temperature, pressure, humidity, and altitude effects with ICAO standard atmosphere.
3D wind calculations with altitude-dependent wind shear modeling.
Statistical analysis with parameter uncertainties for hit probability.
Estimate ballistic coefficients from trajectory data.
Spin effects (Magnus, enhanced spin drift with decay), Earth effects (Coriolis), angular motion (precession/nutation), transonic analysis (pitch damping, stability warnings), trajectory sampling, and form factor corrections.
JSON, CSV, and formatted tables for terminal display and programmatic use.
Foreign Function Interface with C-compatible bindings for iOS, Android, Swift, Python, and other platforms.
The ballistics engine's FFI layer enables native iOS and Android app development. Build your own mobile ballistics apps with the same high-performance Rust core.
Power your game physics with accurate ballistic calculations
The Ballistics Engine provides game developers with physically accurate projectile trajectories that can be easily integrated into any game engine. Whether you're building a realistic military simulator, hunting game, or arcade-style artillery game, our Rust-powered engine delivers:
Sub-millisecond trajectory calculations perfect for 60+ FPS gameplay
True-to-life projectile behavior including drag, wind, and gravity effects
FFI bindings for Unity, Unreal, Godot, and custom engines on all platforms
Lightweight and efficient, perfect for mobile gaming with minimal battery impact
Simple C-compatible API with comprehensive documentation and examples
Calculate lead angles and intercept points for moving targets in real-time
// iOS Objective-C Example (.m file)
#import "ProjectileController.h"
#import "ballistics_ffi.h"
@implementation ProjectileController
- (void)fireProjectileWithVelocity:(float)velocity
mass:(float)mass
bc:(float)bc {
// Initialize FFI inputs
FFIBallisticInputs inputs = {
.muzzle_velocity = velocity,
.ballistic_coefficient = bc,
.mass = mass,
.diameter = 0.308,
.sight_height = 0.05
};
// Calculate trajectory
FFITrajectoryResult* result = ballistics_trajectory(&inputs, NULL);
// Use trajectory points for visualization
for (int i = 0; i < result->num_points; i++) {
FFITrajectoryPoint point = result->points[i];
[self drawTrajectoryPointAtX:point.distance
y:point.drop
z:point.windage];
}
// Clean up
ballistics_free_trajectory_result(result);
}
@end
Run ballistics calculations directly in your browser
Note on Drop Values: When using --auto-zero, values show bullet position relative to your scope's line of sight. Positive values mean the bullet is above your crosshairs, negative values mean it's below. At your zero distance, the value is 0 (bullet hits exactly where you aim).
Statistical analysis for real-world shooting scenarios
Monte Carlo simulations run thousands of virtual shots with realistic parameter variations to predict hit probability and group sizes. This accounts for:
Compare different ammunition loads to find the optimal balance between velocity and consistency. Higher velocity isn't always better if it comes with increased variation.
Each simulation provides comprehensive statistics including:
Flexible unit support with seamless conversion
Get started with common ballistics calculations
# .308 Winchester, 168gr bullet at 2700 fps
./ballistics trajectory \
-v 2700 # Velocity (fps)
-b 0.475 # Ballistic coefficient
-m 168 # Mass (grains)
-d 0.308 # Diameter (inches)
--drag-model g7 # G7 drag model
--max-range 1000 # Maximum range (yards)
--wind-speed 10 # Wind speed (mph)
--wind-direction 90 # Wind from right
--temperature 59 # Temperature (°F)
--pressure 29.92 # Pressure (inHg)
--humidity 50 # Humidity (%)
--altitude 0 # Altitude (feet)
--full # Show all points
# Auto-zero at 200 yards with trajectory to 500 yards
./ballistics trajectory \
-v 2700 -b 0.475 -m 168 -d 0.308 \
--auto-zero 200 # Automatically zero at 200 yards
--max-range 500 \
--full
# Calculate zero for 200 yards
./ballistics zero \
-v 2700 -b 0.475 -m 168 -d 0.308 \
--target-distance 200
# With custom sight height
./ballistics zero \
-v 2700 -b 0.475 -m 168 -d 0.308 \
--target-distance 300 \
--sight-height 0.055 # 2.2 inches
# Output includes:
# - Zero angle in degrees
# - Adjustment in MOA
# - Adjustment in mrad
# - Maximum ordinate
# Statistical analysis with 1000 simulations
./ballistics monte-carlo \
-v 2700 # Base velocity (fps)
-b 0.475 # Base BC
-m 168 # Mass (grains)
-d 0.308 # Diameter (inches)
-n 1000 # Number of simulations
--velocity-std 10 # Velocity std dev (fps)
--angle-std 0.5 # Angle std dev (degrees)
--bc-std 0.01 # BC std dev
--wind-std 2 # Wind speed std dev (mph)
--target-distance 300 # Target distance for hit probability
# Load Development Comparison
# Load 1: Higher velocity, more variation
./ballistics monte-carlo \
-v 2750 -b 0.475 -m 168 -d 0.308 \
-n 1000 \
--velocity-std 15 \
--target-distance 600
# Load 2: Lower velocity, more consistent
./ballistics monte-carlo \
-v 2680 -b 0.475 -m 168 -d 0.308 \
-n 1000 \
--velocity-std 8 \
--target-distance 600
# Estimate BC from trajectory data
./ballistics estimate-bc \
-v 2700 -m 168 -d 0.308 \
--distance1 100 --drop1 0.0 # First point
--distance2 200 --drop2 0.023 # Second point
# Multiple data points for better accuracy
./ballistics estimate-bc \
-v 2700 -m 168 -d 0.308 \
--distance1 100 --drop1 0.0 \
--distance2 200 --drop2 0.023 \
--distance3 300 --drop3 0.091
use ballistics_engine::{
BallisticInputs, TrajectorySolver,
WindConditions, AtmosphericConditions
};
fn main() -> Result<(), Box> {
let inputs = BallisticInputs {
muzzle_velocity: 823.0, // m/s
ballistic_coefficient: 0.475,
mass: 0.0109, // kg
diameter: 0.00782, // meters
sight_height: 0.05, // meters
..Default::default()
};
let wind = WindConditions {
speed: 5.0, // m/s
direction: 1.5708, // 90° in radians
..Default::default()
};
let atmosphere = AtmosphericConditions {
temperature: 15.0, // Celsius
pressure: 1013.25, // hPa
humidity: 50.0, // %
..Default::default()
};
let solver = TrajectorySolver::new(
inputs, wind, atmosphere
);
let result = solver.solve()?;
println!("Max range: {:.2} m", result.max_range);
println!("Time of flight: {:.3} s", result.time_of_flight);
Ok(())
}
// Monte Carlo Simulation via FFI (C/Swift)
// Set up Monte Carlo parameters
FFIMonteCarloParams params = {
.num_simulations = 1000,
.velocity_std_dev = 10.0, // m/s variation
.angle_std_dev = 0.001, // radian variation
.bc_std_dev = 0.01, // BC variation
.wind_speed_std_dev = 2.0, // m/s wind variation
.target_distance = 600.0 // Target at 600m
};
// Run simulation
FFIMonteCarloResults* results = ballistics_monte_carlo(&inputs, NULL, ¶ms);
// Use statistical results
printf("Mean range: %.2f m (σ=%.2f)\n",
results->mean_range, results->std_dev_range);
printf("Hit probability at 600m: %.1f%%\n",
results->hit_probability * 100);
// Access individual shots
for (int i = 0; i < results->num_results; i++) {
printf("Shot %d: Range %.2f m, Impact velocity %.2f m/s\n",
i, results->ranges[i], results->impact_velocities[i]);
}
// Clean up
ballistics_free_monte_carlo_results(results);
# Complete Advanced Physics Example
./ballistics trajectory \
-v 2850 -b 0.690 -m 230 -d 0.338 \
--drag-model g7 \
--twist-rate 8.5 --twist-right \
--enable-magnus \
--enable-coriolis \
--enable-spin-drift \
--enable-wind-shear \
--enable-pitch-damping \
--enable-precession \
--sample-trajectory \
--latitude 38.5 \
--shooting-angle 45 \
--wind-speed 15 --wind-direction 270 \
--altitude 6000 \
--max-range 2000
# Transonic Stability Analysis
./ballistics trajectory -v 3000 -b 0.475 -m 168 -d 0.308 \
--enable-pitch-damping \
--max-range 2000
# Trajectory Sampling at regular intervals
./ballistics trajectory -v 2700 -b 0.475 -m 168 -d 0.308 \
--sample-trajectory \
--sample-interval 25 # Sample every 25 yards
--max-range 1000 -o json
Reference values for popular ammunition
Caliber | Weight | BC (G1) | BC (G7) | Description |
---|---|---|---|---|
.223 | 55gr | 0.250 | - | FMJ |
.223 | 77gr | 0.362 | 0.182 | Match |
.308 | 168gr | 0.475 | 0.224 | Match |
.308 | 175gr | 0.505 | 0.253 | Match |
.308 | 180gr | 0.480 | - | Hunting |
.338 | 300gr | 0.768 | 0.383 | Match |
6.5mm | 140gr | 0.620 | 0.310 | Match |
.50 | 750gr | 1.050 | 0.520 | Match |
Blazing fast calculations powered by Rust's zero-cost abstractions
Get up and running in seconds with our quick installer or build from source
Install the pre-compiled ballistics CLI tool with one command:
curl --proto '=https' --tlsv1.2 -sSf https://ballistics.zip | sh
Supports macOS (Intel & Apple Silicon), Linux, Windows, OpenBSD, NetBSD, and FreeBSD. The installer automatically detects your platform.
Add to your Rust project's Cargo.toml
:
cargo add ballistics-engine
Or manually add:
[dependencies]
ballistics-engine = "0.4.1"
Clone and build the command-line tool:
git clone https://github.com/ajokela/ballistics-engine.git
cd ballistics-engine
cargo build --release
The binary will be at: target/release/ballistics
Test with a basic trajectory:
ballistics trajectory \
-v 2700 -b 0.475 -m 168 -d 0.308 \
--auto-zero 200 --max-range 500
Last Updated: August 2025
This website uses Google Analytics to understand visitor traffic and usage patterns. Google Analytics collects:
The Ballistics Engine software itself (the Rust library and CLI tool) does not collect, transmit, or store any user data. All calculations are performed locally on your device. The software:
The Ballistics Engine is open source software. You can review the entire source code on GitHub to verify our privacy practices.
For privacy-related questions or concerns, please contact us at support@tinycomputers.io.
We may update this privacy policy from time to time. Any changes will be reflected on this page with an updated revision date.