Skip to content

Box collides differently on left and right sides #12

@jmfd

Description

@jmfd

Dynamic Box (A) falling on static Box (B) will collide very differently if it is on the right or left side. If on the right side, it will bounce off as I'd expect. On Box A's left side, it will stay on top of Box (B).

wrongphysics

My glancing seems to show that the Resolver.solveVelocity is giving a different bodyB.anglePrev on the second contact, but I'm no expert on why!

See this simple repro case:

<html>
    <head>
        <script type="text/javascript" src="Matter.js"></script>
    </head>
    <body>
            <div id="canvas-container"></div>
    </body>
</html>

<script>

var container = document.getElementById('canvas-container');
var engine = Matter.Engine.create(container);

engine.world.gravity.y = 1;
engine.render.options.showDebug = true;
engine.render.options.showAngleIndicator = true;

Matter.World.add(engine.world, Matter.Bodies.rectangle(285.5, 323.5, 102, 102, { isStatic: true, density: 1.0, friction: 0.0, restitution: 1.0 }));
Matter.World.add(engine.world, Matter.Bodies.rectangle(380.5, 25.5, 102, 102, { isStatic: false, density: 1.0, friction: 0.0, restitution: 1.0 }));
Matter.World.add(engine.world, Matter.Bodies.rectangle(193.5, 25.5, 102, 102, { isStatic: false, density: 1.0, friction: 0.0, restitution: 1.0 }));

Matter.Engine.run(engine);

</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions