mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Updated p2.js to latest build. Checked tests. Added Debug draw (needs rotation support).
This commit is contained in:
+17
-1
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user