Skip to content

A library providing functions to help calculate and work with 3D projectile trajectories in the Godot game engine.

License

Notifications You must be signed in to change notification settings

nsrosenqvist/godot-trajectory-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trajectory Lib

Screenshot of range calculation demo

This is a utility library that provides tools to work with, and calculate, 3D ballistic trajectories. It's a collection of helpers that are designed to cover most use-cases requiring pre-calculations of velocity, time, position or collisions.

Credits

Much of the code is based on the trajectory solving logic of Forrest Smith's C# library (0.1.0). Refer to his blog for extended explanations on how to use the different techniques in your project. One method is also ported over from Miziziziz's Godot3DProjectileSolver project.

License

MIT

Usage

Most techniques are explained in this blog post. The code is well documented so refer to the file for how to use the API.

Similarly to Godot's intersect_ray, most methods return a Dictionary with the relevant information of the solution. A solution object has the following keys set:

  • position: The calculated point of impact.
  • time: Duration of travel until the point of impact.
  • gravity: Gravity used for solution—the methods using a fixed lateral speed return a variable gravity.
  • velocity: The required velocity to reach the point of impact.

About

A library providing functions to help calculate and work with 3D projectile trajectories in the Godot game engine.

Resources

License

Stars

Watchers

Forks

Packages

No packages published