Matter.js: Circle not accelerating down in inclined plane

Viewed 19

I am writing a simple simulation of a ball rolling down an inclined plane. I drop the ball and it falls to the inclined plane. As it bounces a bit, it picks up speed on the plane until the point where it stops sliding and just rolls.

When it starts to roll, the ball will slow down a bit and then roll the rest of the way at a constant speed. From that point on it will not accelerate at all unlike a normal ball on a slope.

If I set friction to 0, it will accelerate, but the ball does not roll - it just slides down the slope which isn't what I want.

I modified a codepen to show a wireframe version of this: https://codepen.io/efunneko/pen/oNdGbVz

ball slows down on slope

The ball creation is simply:

    Composite.add(world, Bodies.circle(width / 1.2, height / 4, 40, {restitution: 0.5}));
0 Answers
Related