schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

Heightfield bugs/issues #179

Open schteppe opened 9 years ago

schteppe commented 9 years ago
  1. The body angle does not affect Heightfield vs Circle collisions at all
  2. The WebGL demo renderer does not handle rendering heightfields with local shape offsets
  3. there's no support for Heightfield in world.hitTest()
  4. When colliding Heightfield vs Circle, there's some contact points missing. See demo code below
        var app = new p2.WebGLRenderer(function(){

            var world = new p2.World({
                gravity : [0,-10]
            });

            this.setWorld(world);

            var shape = new p2.Heightfield({heights:[0,100,80,200,130,50,70,150,100,100,160], elementWidth: 50 });
            var body = new p2.Body();
            body.addShape(shape);
            world.addBody(body);

            var circle = new p2.Circle({ radius: 40 });
            var body = new p2.Body({ mass: 1, position: [100, 300] });
            body.addShape(circle);
            world.addBody(body);
        });