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

Bodies slow down after collisions #21

Closed
shakiba opened this issue May 11, 2014 · 4 comments
Closed

Bodies slow down after collisions #21

shakiba opened this issue May 11, 2014 · 4 comments

Comments

@shakiba
Copy link

shakiba commented May 11, 2014

I have added this example to demos, the ball slows down after each collision even with friction=0 and restitution=1, is this an expected behavior?

      var ball = Bodies.circle(400, 300, 20, { frictionAir: 0, friction: 0, restitution: 1});
      World.add(_world, [ball]);
      var a = Math.random() * Math.PI * 2;
      Body.applyForce(ball, { x: 0, y: 0 }, {x: 0.2 * Math.cos(a), y: 0.2 * Math.sin(a)});
@liabru
Copy link
Owner

liabru commented May 11, 2014

Here there's also energy being converted to torque, so try also setting the ball's inertia to infinity so the ball can not rotate, for me it then bounces for much longer - is this what you need?

@shakiba
Copy link
Author

shakiba commented May 11, 2014

Perfect! Will it bounce forever now?

@shakiba shakiba closed this as completed May 11, 2014
@liabru
Copy link
Owner

liabru commented May 11, 2014

Yeah in theory I think so, in practice though not sure if energy will be lost through precision errors, update the thread if there are problems

@beetrandahiya
Copy link

hey, i set inertia to infinity but still, its losing energy, i also being a physics student , dont have anything else other than friction due to normal force on contact , i turned friction and frictionAir both to 0, still, not the ideal outcome

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

3 participants