dwhiffing Posted March 10, 2016 Share Posted March 10, 2016 Hey guys, I'm making a top down survival horror game and I've made a cave maze out of p2 physics bodies and i am in the process of implementing raycasting. I'm having trouble getting the position of the vertices of the p2 physics bodies. I understand that p2 uses different units than phaser, and I read somewhere that the conversion is pretty much just * -20 Currently, I'm doing something like this: sprite.body.data.shapes.forEach(shape => { shape.vertices.forEach(vert => { let out = [] this.sprite.body.toWorldFrame(out, vert) this.points.push(out[0] * -20, out[1] * -20) }) }) which should give me a big list of all of the points for the cave. Its getting me very close, but I think I'm missing something small which is throwing every thing off. Can anyone point me in the right direction? Thanks! Link to comment Share on other sites More sharing options...
dwhiffing Posted March 11, 2016 Author Share Posted March 11, 2016 I think the answer to my problem lies in the Phaser BodyDebug code: Link to comment Share on other sites More sharing options...
Recommended Posts