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

bounce feel "jelly" in stacked elements #116

Closed
cruzlutor opened this issue Jul 8, 2015 · 1 comment
Closed

bounce feel "jelly" in stacked elements #116

cruzlutor opened this issue Jul 8, 2015 · 1 comment

Comments

@cruzlutor
Copy link

I am trying to make a column of rectangles, but when i have 4 or more stacked that feel a jelly structure, I need them to feel like bricks

here is a video
https://www.youtube.com/watch?v=VrI40GQuTuI

What property can solve this?

Here is the code

<html>
    <head>
        <script type="text/javascript" src="lib/matter-0.8.0.min.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.0;
engine.render.options.showDebug = true;
engine.render.options.showAngleIndicator = true;

container.addEventListener("click", function(){
    Matter.World.add(engine.world, Matter.Bodies.rectangle(450, 155.5, 30, 30,   {mass: 10, isStatic: false, density: 0.002, friction: 1, restitution: 0, angle: 0}));
});
//     

// }, 1000)
Matter.World.add(engine.world, Matter.Bodies.rectangle(400, 550, 404, 13, { isStatic: true,  density: 0.00005, friction: 1, restitution: 2, angle: 0}));


Matter.Engine.run(engine);

</script>
@liabru
Copy link
Owner

liabru commented Jul 8, 2015

For now you can increase engine.velocityIterations and engine.positionIterations to something like 10 and it should reduce this, though there is a performance cost.

Once #5 has been implemented, this should reduce the issue further, but for now try the above.

@liabru liabru closed this as completed Aug 3, 2015
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

2 participants