JavaScript 2D physics library
Upgrades the poly-decomp dependency, and adds ContactEquation.prototype.getVelocityAlongNormal
. Not much more to see here :)
position
and angle
properties, which indicates the local position in the body they are attached to. This also means that a Shape
instance can be attached to a single Body
.TopDownVehicle
class was added. Use it to make racing games!Rectangle
to Box
380aaa5Shape
constructors so they take their parameters via an options object. This way, Shape
constructor parameters can be passed in the same options object. 380aaa5
new Rectangle(w, h)
=> new Box({ width: w, height: h })
new Capsule(l, r)
=> new Capsule({ length: l, radius: r })
new Circle(r)
=> new Circle({ radius: r })
new Convex(array)
=> new Convex({ vertices: array })
new Heightfield(array, options)
=> new Heightfield({ heights: array, [...other options...] })
new Line(l)
=> new Line({ length: l })
.shapeOffsets
and .shapeAngles
from Body
in favor of the new .position
and .angle
properties in the Shape instances. This means that a shape can only be added to one body. 16e1a47.raycast(result, ray)
. Moved the intersection methods in Ray
to their respective Shape
. d1feff1Body.prototype.applyForce
should now be a vector relative to the Body
position, instead of a world point 28494c1Shape
constructor: material, position, angle, collisionGroup, collisionMask, sensor, collisionResponse 6a20c75 380aaa55d6174a6740de66877aad0f77338444f2AABB.prototype.overlapsRay
vec2.reflect
ea9b6d5TopDownVehicle
class 33846a5Body.prototype.getVelocityAtPoint
33846a5Body.prototype.applyLocalForce
28494c1Body.prototype.applyImpulse
, .applyImpulseLocal
, .vectorToLocalFrame
, . vectorToWorldFrame
872ea6cvec2.vectorToLocalFrame
and vec2.vectorToGlobalFrame
238d120GridBroadphase
since it is buggy and mostly unused e90c672World.prototype.setGlobalEquationParameters
. Use .setGlobalStiffness
and .setGlobalRelaxation
instead 69d494b3cd53ac2690bda0ddb50890d8566146e9doProfiling
and lastStepTime
properties from World
since it is much easier to use the browser profiling tools nowadays. 4223c88World.prototype.clone
c330903Small release, fixes some bugs and adds basic raycasting + experimental CCD.
SAPBroadphase
.endContact
event, bodyB had the value of bodyA..idleTime
in Body
is now initialized correctly.collisonResponse
flag for Body
and Shape
..raycastClosest
, .raycastAll
and .raycastAny
to World
Body.prototype.integrate
.ccdSpeedThreshold
and .ccdIterations
to Body
.motionState
to .type
in class Body
.RevoluteConstraint
. Now the local pivots are passed as options instead of direct arguments. See the constraints demo.World.prototype.toJSON
and .fromJSON
..enableBodySleeping
and .enableIslandSleeping
from World
instances. The enum .sleepMode
can be used instead. See the sleep demo.Spring
to a base class for the new LinearSpring
and RotationalSpring
classes. LinearSpring
can be used as the old Spring
.Utils.ARRAY_TYPE
can now be overridden by injecting a global called P2_ARRAY_TYPE
. Support for GLMAT_ARRAY_TYPE
has been removed..enableFrictionReduction
to Narrowphase
.RevoluteConstraint.prototype.setLimits
.PrismaticConstraint.prototype.setLimits
.LockConstraint
, DistanceConstraint
, and GearConstraint
can now be constructed from current body transforms.RevoluteConstraint
can now be constructed from the current body transforms and a world point.Material
id can now be passed via constructor.ContactMaterial
instances now have a property .contactSkinSize
.Body.prototype.getAABB
.DistanceConstraint
. See the DistanceConstraint demo.Body.prototype.overlaps
.OverlapKeeper
.World.prototype.step
, the substeps are aborted if slower than real time.Heightfield
/Convex
and Heightfield
/Circle
collision support..overlapKeeper
to World
.EventEmitter.prototype.has
can now check if any listeners were added to a given topic.Utils.defaults
..enableIslandSleeping
to World
..useFrictionGravityOnZeroGravity
to World
..useWorldGravityForFrictionApproximation
in World
to .useWorldGravityAsFrictionGravity
to keep things more uniform..frictionIterations
to GSSolver
, and removed .skipFrictionIterations
.2.1.0
.QuadTree
.mat2
.Utils.extend
..setStiffness
and .setRelaxation
methods to Constraint
..stiffness
, .relaxation
and .useGlobalEquationParameters
from GSSolver
..setGlobalStiffness
, .setGlobalRelaxation
, .setGlobalEquationParameters
to World
..eps
to .epsilon
for Equation
..useBoundingBoxes
from NaiveBroadphase
in favor of the new property .boundingVolumeType
in Broadphase
..getMaxForce
and .setMaxForce
to LockConstraint
..bi
, .bj
, .ni
, .ri
, .rj
to .bodyA
, .bodyB
, .normalA
, .contactPointA
, .contactPointB
in Equation
, ContactEquation
and FrictionEquation
classes.IslandSolver
in favor of the new property World.islandSplit
.Constraints
so they all take an options
object as last parameter..collideConnected
to Constraint
..islandSplit
to World
..disableBodyCollision
and .enableBodyCollision
to World
..useWorldGravityForFrictionApproximation
and .frictionGravity
to World
.Heightfield
class..defaultFriction
and .defaultRestitution
from World
, in favor of .defaultContactMaterial
..enabled
to Equation
..surfaceVelocity
to ContactMaterial
..sensor
to Shape
.World
now emits events 'beginContact'
, 'endContact'
and 'preSolve'
..gravityScale
to Body
.SAP1DBroadphase
to SAPBroadphase
..interpolatedPosition
to `Body``..internalStep
to World
..applyGravity
to World
..computeC
to .computeInvC
in Equation
, and made it compute the inverse.Utils.splice
..world
to Body
..fixedRotation
to Body
.AABB
..aabb
and .aabbNeedsUpdate
to Body
, as well as a method .updateAABB
..useBoundingBoxes
to NaiveBroadphase
.Broadphase.aabbCheck
..computeAABB
to Shape
.Broadphase.canCollide
.Body
now inherits from EventEmitter
, and dispatches events 'sleep'
,'sleepy'
and 'wakeup'
..allowSleep
, .sleepState
, .sleepSpeedLimit
, .sleepTimeLimit
, .lastTimeSleepy
as well as methods .sleep
, .wakeUp
and .sleepTick
to Body
.Body.AWAKE
, Body.SLEEPY
, Body.SLEEPING
..enableBodySleeping
to World
..disableRotationalLock
, .lowerLimit
, .upperLimit
to PrismaticConstraint
constructor..enableMotor
, .disableMotor
to PrismaticConstraint
as well as properties .motorEnabled
, .motorSpeed
, .motorEquation
..damping
and .angularDamping
to Body
..applyDamping
to World
..shapeA
and .shapeB
to ContactEquation
and FrictionEquation
..contactEquation
to FrictionEquation
..multiplier
to Equation
..lowerLimitEnabled
, .lowerLimit
, .upperLimitEnabled
, .upperLimit
to RevoluteConstraint
..frictionCoefficient
to FrictionEquation
and Narrowphase
. The solver now updates the friction force bounds dynamically in the solver from this value. FrictionEquation.setSlipForce()
is thus deprecated.Narrowphase.convexPlane
to Narrowphase.planeConvex
.Narrowphase.capsulePlane
to Narrowphase.planeCapsule
..emitImpactEvent
to World
..getBodyById
to World
..skipFrictionIterations
to GSSolver
.PrismaticConstraint
. This breaks backwards compatibility..localAxisA
, .localAnchorA
, .localAnchorB
, to PrismaticConstraint
.