Jump to content

P2 Polygon collision


lonelydatum
 Share

Recommended Posts

Collision between my hero and polygon (ramp) penetrates through the polygon. Here is an image of what I mean.

 

This loads the json file;

this.game.load.physics('rampPolygons', 'assets/gameplay/ramps/exports/ramps_physics.json');

 

 

This is the co-ordinates for the polygon.

{ "ramp0": [{
"density": 2, "friction": 0, "bounce": 0, 
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 0,0,  80,-30, 160,-90, 160,0, 0,0 ] }  ] }
 
 
This applies the polygon to the ramp sprite
ramp.body.clearShapes();
this.body.loadPolygon("rampPolygons", ramp0 );

post-9315-0-95944100-1405694464.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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