Reputation: 2551
this is my jsfiddle : http://jsfiddle.net/mrLt1swj/1/
what i did basically is creating an empty sprite and append the arc as it's child like this :
paddle = graphics2.arc(0, 0, 110, game.math.degToRad(0), game.math.degToRad(45), false);
paddleSprite = game.add.sprite(0, 0);
game.physics.enable(paddleSprite, Phaser.Physics.ARCADE);
paddleSprite.anchor.set(0.5);
// Add the graphics to the sprite as a child
paddleSprite.addChild(paddle);
in this case i can use the physics on the arc , but the problem here
is that the arc is basically a polygon shape, second the position of the sprite is at 0,0
and the arc have different coordinate so the collision will not work if the ball hit the arc instead it will work if it hit the empty sprite
Upvotes: 1
Views: 1156
Reputation: 40668
For polygon (non-rectangular) collisions you have to use P2 physics instead of Arcade physics.
Or skip proper physics and calculate the collisions yourself: check the ball's position against the arc radius and angle.
Upvotes: 1