A lightweight 3D physics engine written in JavaScript.
This release contains the new Trimesh
and ConeTwistConstraint
classes along with a few fixes and optimizations for convex collisions. It should be fully backwards compatible with the previous v0.6.1
.
RaycastVehicle
that didn't caused the world listeners to not add/remove properly.Heightfield
that made some things pass through the field.ConvexPolyhedron.prototype.computeEdges
along with some narrowphase optimizations makes convex/convex collisions more performant..raycastAll
, .raycastClosest
and .raycastAny
to World
.id
properties to Equation
and Shape
.Trimesh
class, including sphere and plane collisions.Body.prototype.vectorToLocalFrame
.Body.prototype.addShape
chainable.Body
constructor: shape
, fixedRotation
, allowSleep
, sleepSpeedLimit
, sleepTimeLimit
, collisionFilterGroup
, collisionFilterMask
, angularDamping
.friction
and restitution
in the Material
class.DistanceConstraint
distance now defaults to the distance between the bodies.Ray.pointInTriangle
.vectorToWorldFrame
, vectorToLocalFrame
, pointToLocal
and pointToWorld
to Transform
.World.prototype.clearForces
.ContactEquation.prototype.getImpactVelocityAlongNormal
.Sphere
constructor now throws an error if radius
is negative.AABB
class is now exposed.AABB.prototype.getCorners
, .toLocalFrame
, .toWorldFrame
, .clone
and .contains
.material
to Shape instances
. It is thus possible to set per-shape materials, that will override the Body
material if it is set.World.prototype.removeBody
, deprecated World.prototype.remove
.Constraint.prototype.enable
and .disable
.HingeConstraint
now extends PointToPointConstraint
class.Vec3.UNIT_X
, Vec3.UNIT_Y
, Vec3.UNIT_Z
.ConeTwistConstraint
.Octree
.uniqueAxes
to ConvexPolyhedron
.HingeConstraint.prototype.getRotationalEquation1
- use property .rotationalEquation1
insteadHingeConstraint.prototype.getRotationalEquation2
- use property .rotationalEquation2
insteadHingeConstraint.prototype.getPointToPointEquation1
- use property .equationX
insteadHingeConstraint.prototype.getPointToPointEquation2
- use property .equationY
insteadHingeConstraint.prototype.getPointToPointEquation3
- use property .equationZ
insteadWorld.prototype.remove
- use World.prototype.removeBody
instead.result
to Ray.prototype.intersectBody(body, result)
is deprecated - please set the .result
property of the Ray
instead.Vec3.prototype.norm
and .norm2
are deprecated - use .length
and .lengthSquared()
instead.Vec3.prototype.mult
is deprecated - use .scale
instead.preStep
and postStep
properties of Body
are deprecated - use the events with the same name in World
instead.World.prototype.numObjects()
is deprecated - use world.bodies.length
instead.World.prototype.rayTest
is deprecated - use .raycastAll
, .raycastClosest
or .raycastAny
instead.Changes
Bug fixes
Other
Changes
RigidBody
to just Body
and changed the constructor signature.Compound
class, since a Body
now contains a flat Shape
hierarchy..motionState
to .type
in Body
.'collide'
event .with
property to .body
.ObjectPool
to just Pool
.World
now dispatches events 'addBody'
and 'removeBody'
.Body.applyImpulse
and Body.applyForce
.World.collision_matrix
and instead added World.collisionMatrix
and World.collisionMatrixPrevious
. They both now work with body indices instead of body IDs.Body.calculateAABB
to .computeAABB
. Added Body.aabbNeedsUpdate
.ConvexPolyhedron
constructor now calculates normals instead of taking them as a parameter.ContactPoint
.Broadphase.collisionPairs
to Broadphase.collisionPairs(world,pairs1,pairs2)
, removing the need of an array return value.ContactGenerator
to Narrowphase
..copy
methods, now they follow the pattern dest.copy(source)
.Ray
class. Now it has a start point and an end point, instead of a start point and a direction..last_dt
to .dt
in World
.Additions
Spring
.SAPBroadphase
.TupleDictionary
..setFromEuler
to Quaternion
..transpose
, .setRotationFromQuaternion
, .scale
to class Mat3
.Broadphase.useBoundingBoxes
, .doBoundingBoxBroadphase
and .intersectionTest
.Body.collisionFilterGroup
and Body.collisionFilterMask
.GridBroadphase
, though it only supports Plane
and Sphere
for now.SPHSystem
.RaycastVehicle
and WheelInfo
.RigidVehicle
.Heightfield
.