olegawrt Posted May 29, 2015 Share Posted May 29, 2015 Hello, I have a problem when I use addPolygon. Polygon change position image. When I turn on debug I see images, and new shape draw in center. Second problem I don't now why image and shape Polygon is different. How fix this problem ? I not seen problem when I use addRectangle. Image and new shape is corect in tile 70px x 70px. Code: function create() { ... groups.tile = game.add.group(); groups.tile.enableBody = true; groups.tile.enableBodyDebug = true; groups.tile.physicsBodyType = Phaser.Physics.P2JS; groups.tile.collideWorldBounds = false; ... var obj = groups.tile.create((x * map.width) - (map.width / 2), (y * map.height) - (map.height / 2), spriteName, numberTile); obj.body.static = true; obj.body.fixedRotation = true; obj.body.collideWorldBounds = true; obj.body.clearShapes(); var myPolygonArray= [ [0,0], [0,70], [70,70], [70,46], [25,46], [25,0]]; obj.body.addPolygon({}, myPolygonArray); } Example: Link to comment Share on other sites More sharing options...
olegawrt Posted May 31, 2015 Author Share Posted May 31, 2015 If someone found it there any solution? Link to comment Share on other sites More sharing options...
Recommended Posts