Updated p2.js to latest build. Checked tests. Added Debug draw (needs rotation support).

This commit is contained in:
photonstorm
2014-02-12 05:34:31 +00:00
parent 2c100754bb
commit c6cc2c9d71
6 changed files with 176 additions and 7 deletions
+17 -1
View File
@@ -6740,7 +6740,7 @@ Body.prototype.updateAABB = function() {
angle = shapeAngles[i] + this.angle;
// Get shape world offset
vec2.rotate(offset,shapeOffsets[i],angle);
vec2.rotate(offset,shapeOffsets[i],this.angle);
vec2.add(offset,offset,this.position);
// Get shape AABB
@@ -9101,6 +9101,18 @@ function World(options){
bodyB : null,
};
/**
* Fired after the Broadphase has collected collision pairs in the world.
* Inside the event handler, you can modify the pairs array as you like, to
* prevent collisions between objects that you don't want.
* @event postBroadphase
* @param {Array} pairs An array of collision pairs. If this array is [body1,body2,body3,body4], then the body pairs 1,2 and 3,4 would advance to narrowphase.
*/
this.postBroadphaseEvent = {
type:"postBroadphase",
pairs:null,
};
/**
* Enable / disable automatic body sleeping
* @property allowSleep
@@ -9295,6 +9307,10 @@ World.prototype.internalStep = function(dt){
// Broadphase
var result = broadphase.getCollisionPairs(this);
// postBroadphase event
this.postBroadphaseEvent.pairs = result;
this.emit(this.postBroadphaseEvent);
// Narrowphase
np.reset(this);
for(var i=0, Nresults=result.length; i!==Nresults; i+=2){