Giter VIP home page Giter VIP logo

Comments (5)

liabru avatar liabru commented on May 2, 2024

For one thing, restitution is strictly [0,1] so a value of 2 is invalid (creates energy).
Also, as it stands, restitution may not be particularly accurately simulated - I think it may require some more work.

Another problem is avoid using high friction values, since they are unstable (a known issue with the friction system) - a reasonable value is more like 0.1.

Regarding the effect of shape on response - I've looked into this before.
I'm not yet 100% sure if shape should or should not have an effect in this simulation.
In real life, it does, but I'm not sure if this is for reasons that are not simulated in this engine.

For example, in real life, consider a super elastic metal ball bearing dropped to the ground - when it hits it bounces back a significant amount.

Now consider if the same material of that ball were stretched out into a thin tube, and you drop it again in real life.

Does it bounce as well as a ball, assuming it impacts exactly edge parallel on its longest edge like in the simulation?
I don't think it will?

Is there a difference in response between bouncing on the long edge vs bouncing on the ends? I think there is?

E.g. It's possible to get a long wooden stick to bounce if it hits on its ends, rather than falling flat on its longest side.

Why is this? I'm not 100% sure whether its due to material properties (e.g. internal compression / decompressions) which are not simulated or whether it naturally falls out of the kinetic equations regarding contact normals vs velocity and torque and the offset to centre of mass.

I'll have to investigate, thanks for providing the report.

from matter-js.

jmfd avatar jmfd commented on May 2, 2024

Two things I've discovered:

  1. Dropping a rectangle at a 45 degree angle will have it behave more like a circle
  2. The above example was using the default frictionAir value of 0.01. When set to 0, a 45-degree rectangle will be mostly elastic at 1.0 restitution. I say mostly because sometimes it will bounce lower and sometimes higher than its starting point. I'm not sure if there's some other variable getting in the way.

I don't have enough physics knowledge to comment on whether it is accurate to materials, but in general one of the first things I do with a physics engine is drop a box and see it bounce, and this was not inline with expectations (and I believe some other engines I played with).

from matter-js.

liabru avatar liabru commented on May 2, 2024

I've just realized something else on this issue - to test restitution you need to make sure to set frictionAir on the body to 0 and also I'd set friction to 0 too. Air friction is probably why you wasn't getting a 100% response.

I just tried it, and a restitution value of 1 seems to work as expected (or at least, close enough).

from matter-js.

jmfd avatar jmfd commented on May 2, 2024

Yes, I realized that later as well. From (2) in #13 (comment) , even when frictionAir is 0 and being a circle there's still a bit of instability in how high the object bounces, but it is much better.

from matter-js.

liabru avatar liabru commented on May 2, 2024

I'm going to close this for now - from my testing the results seem close enough given the above, albeit not always completely perfect but I think this is close enough for Matter's intended uses.

Feel free to comment further if you find more problems on this though

from matter-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.