xacrox Posted September 30, 2014 Share Posted September 30, 2014 Hello!I am fairly new to the phaser framework. So please excuse my noob ignorance if this is an easy question. I know that adding collision on a object such can be easily done with:game.physics.arcade.collide(gameObject1, gameObject2, collisionCallback, processCallback, context); However when you have an object like this ice spike:You would likely need to define a polygon in order for proper collision detection. Which should theorectically be pretty easy considering it's pretty much a triangle.My question is however... when I get into more unique elements say for example this water:And I want to make only the non-transparent parts collide. Is there an easier way?Is there a way to detect non-transparent pixels as opposed to defining each aspect by hand?Hope this makes sense & thanks so much in advance! Link to comment Share on other sites More sharing options...
lewster32 Posted October 1, 2014 Share Posted October 1, 2014 Not in Arcade Physics I'm afraid. Arcade is based on 'AABB' collision detection, which stands for Axis Aligned Bounding Box - basically all objects have a non-rotatable rectangle collision area, which is very fast, but obviously has limitations here. Often a tradeoff is made when trying to apply rectangles to triangular objects whereby the body size is reduced to provide coverage over the part of the triangle that matters. If you really need non-rectangular collision bounds, you're going to have to use P2 physics instead of Arcade. Then you can define arbitrary simple polygons as collision hulls. kctang, Dread Knight, theoutlander and 1 other 4 Link to comment Share on other sites More sharing options...
Recommended Posts