mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 14:38:30 +00:00
Merge pull request #1674 from englercj/dev
Fix debug drawing for p2 physics bodies
This commit is contained in:
commit
358e0a6675
1 changed files with 14 additions and 13 deletions
|
@ -56,6 +56,8 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
|
|||
|
||||
this.draw();
|
||||
|
||||
this.updateSpriteTransform();
|
||||
|
||||
};
|
||||
|
||||
Phaser.Physics.P2.BodyDebug.prototype = Object.create(Phaser.Group.prototype);
|
||||
|
@ -109,6 +111,18 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|||
{
|
||||
this.drawCircle(sprite, offset[0] * this.ppu, offset[1] * this.ppu, angle, child.radius * this.ppu, color, lw);
|
||||
}
|
||||
else if (child instanceof p2.Plane)
|
||||
{
|
||||
this.drawPlane(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, color, lineColor, lw * 5, lw * 10, lw * 10, this.ppu * 100, angle);
|
||||
}
|
||||
else if (child instanceof p2.Line)
|
||||
{
|
||||
this.drawLine(sprite, child.length * this.ppu, lineColor, lw);
|
||||
}
|
||||
else if (child instanceof p2.Rectangle)
|
||||
{
|
||||
this.drawRectangle(sprite, offset[0] * this.ppu, offset[1] * this.ppu, angle, child.width * this.ppu, child.height * this.ppu, lineColor, color, lw);
|
||||
}
|
||||
else if (child instanceof p2.Convex)
|
||||
{
|
||||
verts = [];
|
||||
|
@ -123,18 +137,6 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|||
|
||||
this.drawConvex(sprite, verts, child.triangles, lineColor, color, lw, this.settings.debugPolygons, [offset[0] * this.ppu, -offset[1] * this.ppu]);
|
||||
}
|
||||
else if (child instanceof p2.Plane)
|
||||
{
|
||||
this.drawPlane(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, color, lineColor, lw * 5, lw * 10, lw * 10, this.ppu * 100, angle);
|
||||
}
|
||||
else if (child instanceof p2.Line)
|
||||
{
|
||||
this.drawLine(sprite, child.length * this.ppu, lineColor, lw);
|
||||
}
|
||||
else if (child instanceof p2.Rectangle)
|
||||
{
|
||||
this.drawRectangle(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, angle, child.width * this.ppu, child.height * this.ppu, lineColor, color, lw);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -155,7 +157,6 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|||
g.lineStyle(lineWidth, color, 1);
|
||||
g.beginFill(fillColor);
|
||||
g.drawRect(x - w / 2, y - h / 2, w, h);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue