Skip to content

Fix: projectile trajectory drift at high simulation rates - #61

Merged
elyosh merged 3 commits into
elyosh:mainfrom
raistlen007:fix/projectile-fractional-movement
Nov 7, 2026
Merged

elyosh merged 3 commits into
elyosh:mainfrom
raistlen007:fix/projectile-fractional-movement

Conversation

@raistlen007

Copy link
Copy Markdown
Contributor

Steps to reproduce issue - launch T1M1 (Y-wing tutorial), bank and come to a stop. fire torpedoes, observe that the torpedoes drift away from reticle center.

Cause: At high simulation rates, projectile movement is calculated in smaller increments. The Q15 fixed-point multiplication truncates each axis independently, discarding fractional displacement every step. This causes cumulative directional drift, especially for slower projectiles.

Solution: preserve each axis's fractional remainder between updates, carrying it into subsequent movement calculations. The remainders are reset when projectile slots are reused, preventing movement state from carrying over to new projectiles.

Reset the carried fraction through one function instead of four copies,
and wrap the step lines at the column limit.
@raistlen007

Copy link
Copy Markdown
Contributor Author

Merged current main (no conflicts). Small cleanup: the fraction reset is one function now instead of four copies.

@elyosh
elyosh merged commit d4b5c7f into elyosh:main Nov 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants