Skip to content

v0.7.0

Compare
Choose a tag to compare
@schteppe schteppe released this 12 Jul 19:18
· 195 commits to master since this release

Summary

  • This release makes it more easy and verbose to construct Shapes due to new constructors.
  • Shapes now have 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.
  • The raycasting API is refactored and should now be more verbose and flexible.
  • TopDownVehicle class was added. Use it to make racing games!

Changes

  • Renamed Rectangle to Box 380aaa5
  • Updated all Shape 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 })
  • Removed .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
  • Raycasting API is scratched and rewritten. Replaced World.prototype.raycastAll, .raycastClosest and .raycastAny with .raycast(result, ray). Moved the intersection methods in Ray to their respective Shape. d1feff1
  • Enabled island splitting by default 1aed70b
  • Increased default solver tolerance 1aed70b
  • The "point" argument in Body.prototype.applyForce should now be a vector relative to the Body position, instead of a world point 28494c1

Fixes

  • Event objects now release references to objects in parameters after emit fe2461b
  • Fix for requirejs via phaser ced0558

Additions

  • The following options can now be passed via the Shape constructor: material, position, angle, collisionGroup, collisionMask, sensor, collisionResponse 6a20c75 380aaa5
  • Added AABB.prototype.containsPoint 9423e3a
  • Added vec2.getLineSegmentsIntersection and vec2.getLineSegmentsIntersectionFraction a01ee11
  • Added AABB.prototype.overlapsRay
  • Added vec2.reflect ea9b6d5
  • Added TopDownVehicle class 33846a5
  • Added Body.prototype.getVelocityAtPoint 33846a5
  • Added object pools and prefilling 3537a2e 0b2a648
  • Added Body.prototype.applyLocalForce 28494c1
  • The following options can now be passed to Body constructor: allowSleep, collisionResponse, gravityScale, sleepSpeedLimit, sleepTimeLimit, id
  • Added Body.prototype.applyImpulse, .applyImpulseLocal, .vectorToLocalFrame, . vectorToWorldFrame 872ea6c
  • Added vec2.vectorToLocalFrame and vec2.vectorToGlobalFrame 238d120

Removals

  • Removed GridBroadphase since it is buggy and mostly unused e90c672
  • Removed World.prototype.setGlobalEquationParameters. Use .setGlobalStiffness and .setGlobalRelaxation instead 69d494b
  • Removed doProfiling and lastStepTime properties from World since it is much easier to use the browser profiling tools nowadays. 4223c88
  • Removed broken method World.prototype.clone c330903