mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 00:53:42 +00:00
Merge pull request #626 from georgiee/fix-circle-parsing2
Multiple circle shapes in a body with position
This commit is contained in:
commit
01d911a2f9
2 changed files with 11 additions and 8 deletions
|
@ -1136,14 +1136,17 @@ Phaser.Physics.P2.Body.prototype = {
|
|||
|
||||
if (fixtureData.circle)
|
||||
{
|
||||
// A circle has unfortunately no position in p2. pretty useless.
|
||||
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius));
|
||||
shape.collisionGroup = fixtureData.filter.categoryBits;
|
||||
shape.collisionMask = fixtureData.filter.maskBits;
|
||||
shape.sensor = fixtureData.isSensor;
|
||||
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius))
|
||||
shape.collisionGroup = fixtureData.filter.categoryBits
|
||||
shape.collisionMask = fixtureData.filter.maskBits
|
||||
shape.sensor = fixtureData.isSensor
|
||||
|
||||
this.data.addShape(shape);
|
||||
generatedShapes.push(shape);
|
||||
var offset = p2.vec2.create();
|
||||
offset[0] = this.world.pxmi(fixtureData.circle.position[0] - this.sprite.width/2)
|
||||
offset[1] = this.world.pxmi(fixtureData.circle.position[1] - this.sprite.height/2)
|
||||
|
||||
this.data.addShape(shape, offset);
|
||||
generatedShapes.push(shape)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|||
|
||||
if (child instanceof p2.Circle)
|
||||
{
|
||||
this.drawCircle(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, angle, child.radius * this.ppu, color, lw);
|
||||
this.drawCircle(sprite, offset[0] * this.ppu, offset[1] * this.ppu, angle, child.radius * this.ppu, color, lw);
|
||||
}
|
||||
else if (child instanceof p2.Convex)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue