PrizrakPro Posted December 1, 2015 Share Posted December 1, 2015 There is an object with 6 surfaces.Created with the help of loadPolygon. How can I determine the surface, which the object encountered?Sorry, I do not speak English. Link to comment Share on other sites More sharing options...
PrizrakPro Posted December 4, 2015 Author Share Posted December 4, 2015 OK. My answer himself.surface = []surface[1] = player.body.addCircle(1,x1,y1);surface[1].sensor=true;surface[2] = player.body.addCircle(1,x2,y2);surface[2].sensor=true;surface[3] = player.body.addCircle(1,x3,y3);surface[3].sensor=true;surface[4] = player.body.addCircle(1,x4,y4);surface[4].sensor=true;surface[5] = player.body.addCircle(1,x5,y5);surface[5].sensor=true;surface[6] = player.body.addCircle(1,x6,y6);surface[6].sensor=true;player.body.onBeginContact.add(ContSurf, this);function ContSurf (body, bodyB, shapeA, shapeB, equation) { var i = find(surface, shapeA) if(i!=-1) console.log('Contact surface '+i) }} Link to comment Share on other sites More sharing options...
Recommended Posts