JavaScript 2D physics
A physics body.
Options:
- shape: A {p2.Shape} used for collision detection. If absent the body will not collide.
- mass: A number >= 0. If zero, the body becomes static. Defaults to static [0].
- position (vec2)
- velocity (vec2)
- angle (number)
- angularVelocity (number)
- force (vec2)
- angularForce (number)
Base class for broadphase implementations.
Circle shape class.
Non-penetration constraint equation.
Base class for constraint equations.
Iterative Gauss-Seidel constraint equation solver.
Broadphase that uses axis-aligned bins.
Naive broadphase implementation. Does N^2 tests.
Particle shape class.
Plane shape class. The plane is facing in the Y direction.
Base class for shapes.
Base class for constraint solvers.
A spring, connecting two bodies.
Options:
- restLength: A number > 0. Default: 1
- stiffness: A number >= 0. Default: 100
- damping: A number >= 0. Default: 1
The dynamics world, where all bodies and constraints lives.
Options:
- solver (p2.Solver) Default: {p2.GSSolver}
- gravity (vec2) Default: -9.78
- broadphase (p2.Broadphase) Default: {p2.NaiveBroadphase}