[SOLVED] Newton's cradle not transforming force properly

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

[SOLVED] Newton's cradle not transforming force properly

So I started working on an example for the example browser of Bullet Physics and I would like to get the Newtonian pendulum (Newton's Cradle) to work properly. However, if one pendulum hits the 4 others, they all somehow move a bit and not only the one on the other side. I am using restitution to get the pendula fully elastic (max realistic restitution is 1, right?), also I found out that there is a hitFraction, but it does not do anything visible. Any idea on how to fix this? I appended my example files. You can move the pendulum using key 3, and change the lengths of the pendula using key 1 and 2.

Here is a video of what I see with 5 and 3 pendula:

https://youtu.be/leDccYvnRzU
Attachments
NewtonianPendulum.h
NewtonianPendulum.cpp
Last edited by benelot on Fri Jun 03, 2016 3:37 pm, edited 1 time in total.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Newtonian pendulum not transforming force properly

Took a look at the code and video but haven't added it to my project yet so can't say the following is 100% accurate/going to fix it, but:

-Video looks like it's doing what it's supposed to, at least from a theoretical perspective. In one step there's zero motion so zero propagation. Even in real-world the momentum transfer isn't instantaneous. The multibody method might work a bit better, but not sure if the setup would be as trivial
-From the above, there's currently no room for motion, so maybe adding a bit of empty space will help. Propagation will end up taking n frames (n=pendulums-2), but it will likely be a bit more visually correct
- Similarly, you can try using a smaller time-step and more rigid solver, or even multibody

I might try it out in the morning after tuning my example a bit (need the right defaults to show off the methods).
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Newtonian pendulum not transforming force properly

Hello Basroil,

Thanks for posting, small spaces between the balls indeed make it slightly more realistic. Still it does not make it move in a perfect force transformation manner (https://www.youtube.com/watch?v=JadO3RuOJGU), but who cares. It is well enough for an example. I will quickly try different solvers and a smaller timestep, maybe it helps.

Edit: The problem was stupidly simple, I forgot to set the intial restitution to 1. So the force did not propagate, only after a slight move of the restitution slider, which set the restitution for the first time.