A Minecraft Paper plugin written in Kotlin allowing players to see the trajectories of different projectiles in real time.
The motion of projectiles in Minecraft is made up like this:
- There's an initial velocity to a projectile:
- Enderpearl, Snowball, Egg: 1.5
- Bow, fully charged: 3.0
- Trident, fully charged, unenchanted: 2.5
- Crossbow: 3.15
- Every tick, the projectile's velocity vector get's multiplied by a drag coefficient of 0.99
- When the projectile is in water however, velocity of throwable projectiles (enderpearl, egg, snowball, experience bottle, potion) get's multiplied by 0.8 every tick, velocity of arrows gets multiplied by 0.6 every tick and velocity of tridents gets multiplied by 0.99 every tick
- After drag has been applied, the gravitational acceleration is subtracted from the y-Component of the velocity vector every tick. Enderpearls, eggs and snowballs have a grvitational acceleration of 0.03. Thrown potions have a gravitational acceleration of 0.05 and experience bottles of 0.07. Arrows and tridents have a gravitational acceleration of 0.05000000074505806. This is the same in water and in air.
From this, we can derive the velocity in x and y direction (we assume projectile is in air).
By solving this recurrence equation we get:
We can now get to the actual position equations by integration:
We now have to find suitable constants of integration, so that
We now solve for
Now we can substitute
The trajectory of a projectile in Minecraft with friction coefficient of
Here's a simulation of this graph where you can adjust the values: https://www.geogebra.org/calculator/awvet877