Open wenerme opened 5 years ago
The brown part is the static water,build by convex, in the end, the box was flying out of the brown part,but the circle is fine.
let water = this.water = new p2.Body({ type: p2.Body.STATIC, }); water.label = BodyLabels.water; waters.forEach(w => { w.forEach(a => { let convex = new p2.Convex({ vertices: Matter.Vertices.clockwiseSort(a).map(v => [v.x, v.y]), collisionGroup: Collisions.water, collisionMask: Collisions.blockMask, }); water.addShape(convex); }) }); world.addBody(water);
The box is very simple
let body = new p2.Body({ mass: 1, position: [350, 480], }); body.addShape(new p2.Box({ width: 72, height: 36, collisionGroup: Collisions.rock, collisionMask: Collisions.blockMask, })) world.addBody(body)
// MyWorld extends p2.World let world = new MyWorld({ gravity: [0, 0], }); world.solver.iterations = 50
But I do use pixel unit, dose this will cause the problem ? because kms is not very friendly.
The brown part is the static water,build by convex, in the end, the box was flying out of the brown part,but the circle is fine.
The box is very simple
But I do use pixel unit, dose this will cause the problem ? because kms is not very friendly.