Jump to content

collision detection between graphics and sprite in phaser


Recommended Posts

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 childpaddleSprite.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

  1. how can i set the collision bound of the arc so the collision between the ball and the arc work
  2. is there any possible solution where i can set physics to arc and not use the sprite


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...