schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 329 forks source link

endContactEvent return e.bodyA and e.bodyB is the same #142

Closed joneszhuchinagd closed 9 years ago

joneszhuchinagd commented 9 years ago

endContact return e.bodyA and e.bodyB is the same as following in p2.js source code:

// Emit end overlap events
if(this.has('endContact')){
    this.overlapKeeper.getEndOverlaps(endOverlaps);
    var e = this.endContactEvent;
    var l = endOverlaps.length;
    while(l--){
        var data = endOverlaps[l];
        e.shapeA = data.shapeA;
        e.shapeB = data.shapeB;
        e.bodyA = data.bodyA;
        e.bodyB = data.bodyA;// this may be "data.bodyB"   ???  
        this.emit(e);
    }
}
schteppe commented 9 years ago

This is fixed in master. Check out and rebuild yourself using grunt. The fix will be included in next release.

joneszhuchinagd commented 9 years ago

thanks very much! u are such a great man