scofield Posted May 24, 2016 Share Posted May 24, 2016 Hi. Is it possible to detect collision between graphics shape and sprite? Attached image it is what I'm talking about. Is it possible to detect collision with that yellow shape (arc)? Link to comment Share on other sites More sharing options...
scofield Posted May 24, 2016 Author Share Posted May 24, 2016 Should I use this libraries - https://github.com/jriecken/sat-js | https://github.com/hexus/phaser-sat-example ? Link to comment Share on other sites More sharing options...
Umz Posted May 24, 2016 Share Posted May 24, 2016 Not certain exactly, as I've never had to deal with it in Phaser yet, but, if you're drawing the arc as a Geometry object, you can try the .getBounds() from the Sprite object, so you'll be colliding shape to shape. Link to comment Share on other sites More sharing options...
scofield Posted May 25, 2016 Author Share Posted May 25, 2016 17 hours ago, Umz said: Not certain exactly, as I've never had to deal with it in Phaser yet, but, if you're drawing the arc as a Geometry object, you can try the .getBounds() from the Sprite object, so you'll be colliding shape to shape. Arc is not Geometry object, it's just graphic element. I'm thinking about to add some "invisible" Geometry object (behind graphic element) that can we collide with other object, but for now I have some troubles. Link to comment Share on other sites More sharing options...
scofield Posted June 3, 2016 Author Share Posted June 3, 2016 (Basically, what I said in the comment below) Ok. Solution I found is to draw graphic objects and then generate geometry object using native Phaser functions, or as I did using https://github.com/jriecken/sat-js library. And after you setuped geometry objects you can detect collisions between any element on the canvas you want. Link to comment Share on other sites More sharing options...
Recommended Posts