0.2.3 • Published 7 months ago

@footgun/planck v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@footgun/planck

This is an independently maintained fork of Planck.js at v1.0.6

Why the fork?

There are 2 main reasons:

  1. Use array notation for Vectors instead of Objects.
  2. Vectors should be pure data, rather than having every single vector instance a class with dozens of methods attached.

Planck way:

import { Vec2 } from 'planck'

const p = new Vec2(50, 50)   // generates an Object Oriented monstrosity
console.log(p)    // { x: 50, y: 50, ...pile o' functions }

I use array notation in my projects, so I want to declare vectors like this:

import { Vec2 } from '@footgun/planck'

const p = Vec2.create(50, 50)  // generates pure data
console.log(p)   // [ 50, 50 ]    A nice simple array.  You know, like, data.  :)

These 2 changes make it possible to re-use other popular libraries for vector/matrix math. Vectors produced by gl-matrix and wgpu-matrix are fully interoperable with this physics engine.

References

You can find the original library here.

All of the same examples and documentation should be the same for this port, except for constructing Vec2 and Vec3 instances.

For a fantastic, compatible Vector/Matrix/Math library check out wgpu-matrix

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.0

7 months ago