⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

LeXXik/ballistics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ballistics

Ballistics demo

Playcanvas logo AssemblyScript logo

Ever wondered, what impulse should I apply to the projectile so that it hits the target? This library will give you an answer. Ballistics is a WASM library that helps to calculate a proper velocity vector for projectiles.

Playcanvas Project

Live Demo

Grab Me a Coffee at ko-fi.com

The library is based on the wonderful magic of trajectory calculations by Forrest Smith. Check out his original post with the explanations.

Library features a low-level WASM binary and a high-level platform implementation.

  • Written in AssemblyScript and compiled to WASM for high performance
  • Features Playcanvas implementation, so it works with it out of the box
  • Magically produces a correct impulse vector against both static and moving targets

Playcanvas Online Installation

  1. Download and place anywhere in your project the contents of dist/pc-ballistics folder.
  2. Wait for ballistics:ready event, or check if Ballistics is in the global scope. See this sample project for a simple setup.

API

You can find following API specs in this repository Wiki:

  • Low level WASM binary API. You want this, if you are making your own implementation.
  • High level Playcanvas implementation API. You want this, if you use this library with Playcanvas.

Development

Building

For production release:

$ gulp build
Testing

The tests are simple. Cubic, quartic and quadratic equations are tested against WolframAlpha results. Links to the test inputs are inside the comments of tests.

$ npm run test

License

MIT

About

Ballistics WASM for projectiles trajectories

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •