{"id":50823280,"url":"https://github.com/sunsided/ballistics","last_synced_at":"2026-06-13T16:10:50.361Z","repository":{"id":353760371,"uuid":"812367795","full_name":"sunsided/ballistics","owner":"sunsided","description":"A Kalman filter ballistic curve estimation playground","archived":false,"fork":false,"pushed_at":"2026-05-04T20:35:05.000Z","size":216,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-04T22:26:14.652Z","etag":null,"topics":["ballistic-curve","kalman-filter","monte-carlo-sampling","rust","simulation"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunsided.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-06-08T17:27:15.000Z","updated_at":"2026-05-04T20:35:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sunsided/ballistics","commit_stats":null,"previous_names":["sunsided/ballistics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sunsided/ballistics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fballistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fballistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fballistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fballistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/ballistics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fballistics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34290605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ballistic-curve","kalman-filter","monte-carlo-sampling","rust","simulation"],"created_at":"2026-06-13T16:10:49.651Z","updated_at":"2026-06-13T16:10:50.357Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ballistics Estimation\n\n[![CI](https://github.com/sunsided/ballistics/actions/workflows/ci.yml/badge.svg)](https://github.com/sunsided/ballistics/actions/workflows/ci.yml)\n[![license: EUPL-1.2](https://img.shields.io/badge/license-EUPL--1.2-blue.svg)](https://github.com/sunsided/ballistics)\n\nA small Rust/ggez playground that tracks a wind-perturbed projectile with a Kalman filter and predicts its impact zone on the ground via Monte-Carlo sampling of the filter's covariance. Acts as a testing ground for the [minikalman](https://github.com/sunsided/minikalman-rs) crate.\n\n![Screenshot](docs/screenshot.png)\n\n*Blue = true firing trajectory (gravity only), Green = filter-predicted trajectory, Cyan dot + ellipse = state estimate with 1σ covariance, Orange bar + whiskers = predicted impact zone (±2σ with min/max).*\n\n## What it does\n\n- An opponent on the right edge fires projectiles with a random launch angle drawn from Normal(60°, 10°) clamped to 25°–80° and a speed of 100–120 m/s.\n- Gravity (-9.81 m/s²) and a time-correlated wind model (sinusoidal base plus Ornstein–Uhlenbeck-style correlated noise on the x-axis) perturb the flight.\n- The observer receives noisy 2D position measurements each physics tick (uniform noise in ±5 px per axis).\n- A 6-state linear Kalman filter with state vector `[x, y, vx, vy, ax, ay]` (constant-acceleration model, dt-based state transition) is built on `minikalman`; the measurement matrix observes position only.\n- Impact prediction runs 64 Monte-Carlo rollouts per update on a background thread: it Cholesky-decomposes the 4×4 position/velocity sub-covariance, draws Gaussian samples, propagates each sample until it crosses the ground (with a quadratic root-solve for the exact crossing time), and aggregates mean, std-dev, min, and max of the landing x to draw the impact zone.\n- Game time is accelerated by `GAME_TIME_FACTOR = 10.0` at `PHYSICS_FPS = 60` for faster iteration.\n\n## Running it\n\n```bash\ncargo run --release\n```\n\nThe `resources/` directory containing `LiberationMono-Regular.ttf` must be present, as `main.rs` adds it as a resource path for text rendering. The font is stored via [Git LFS](https://git-lfs.com/); make sure Git LFS is installed (`git lfs install`) before cloning, or run `git lfs pull` after cloning.\n\n## Ideas\n\n- Can we estimate the mass of the projectile as well?\n  - Both the mass and the initial firing force determine the acceleration.\n  - The mass will affect the curvature of the trajectory.\n\n## License\n\nLicensed under the [European Union Public Licence v1.2 (EUPL-1.2)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fballistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Fballistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fballistics/lists"}