question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restitution doesn't seem right sometimes

See original GitHub issue

In the following gif both cats share the same physics properties.

two cats fall at a gelatine block, the left one is rotated 90 degrees and doesn't bounce

Cats’ restitution is set as 0.1 Ground restitution is set as 0.8

Everything was created using the Matter.Bodies.rectangle.create(x,y,w,h,o) constructor.

The cats bounce normally unless their rotation is set to an angle between 71 and 109 degrees (~1.22 to ~1.91 radians). As soon as the rotation goes to 70 or 110 degrees the cats bounce normally.

Here’s a fiddle for reproducing this.

Is that expected behavior?

I’ve also noticed that static bodies’ restitution doesn’t play a role in physics simulation. Is that correct?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
TiagoMarinhocommented, Aug 29, 2020

Setting inertia to infinity solves my problem entirely, but while your explanation on why this could be expected behavior seems right to me, I don’t get why this problem only happens for my simulation when the left rectangle is set to an angle EXACTLY between -71 and -109, and as soon as it go to -70 or -110 (same applies for positive rotations) the restitution fixes itself. Here’s a demo:

-80° (it looks like this since -109°): oct-22-2016 02-51-12

-71°: oct-22-2016 02-48-32

-70°: oct-22-2016 02-48-07

Seen from this perspective this looks like unexpected behavior, doesn’t it? Anyway, not a big issue after all, just a little weird collision response. Feel free to close the issue if you think this is not a bug at all.

Also, I’m okay with the static bodies’ predefined restitution.

2reactions
rsmmntcommented, Mar 26, 2019

little update - i figured it out, if you create a body like this: var rect = Matter.Bodies.rectangle(x, y, width, height, { isStatic: true, restitution: 0.9 }

restitution is set to 0 anyway, you should modify restitution manually after body creation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Three Reasons Conversion Doesn't Involve Restitution
We don't have to do anything to be accepted by God except repent and put our faith in Christ. Repentance Means Change Versus...
Read more >
How is restitution calculated? A defense lawyer explains
Restitution is calculated by totaling the financial losses suffered by the victim of a crime. Different states use different systems.
Read more >
Challenging Restitution: an Often Overlooked Area of Advocacy
If you provide the clear authority to give the judge a reason not to saddle your client with enormous debt, judges often do...
Read more >
Restitution Process - Department of Justice
The Restitution Process (Fraud and/or Financial crimes). In federal court, a convicted offender may be ordered to reimburse victims for ...
Read more >
QUESTION 62 Restitution Next we have to consider restitution ...
Therefore, restitution does not seem to be an act of any part of justice. ... both to substance and to the right of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found