Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box incorrect collision with convex #344

Open
wenerme opened this issue Apr 14, 2019 · 0 comments
Open

Box incorrect collision with convex #344

wenerme opened this issue Apr 14, 2019 · 0 comments

Comments

@wenerme
Copy link

wenerme commented Apr 14, 2019

out

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant