[jit.phys] Newton's Cradle example
after finishing the jit.phys-introduction I have been working on a virtual Newton’s Cradle with more than two spheres.
Unfortunately, the behaviour of my Newton’s Cradle is not yet realistic. I would be interested to learn more about why this is the case and what I can do in oder to get a more realistic behaviour. E.g., I have observed that the behaviour is more realistic if there is a small space between the spheres.
I’d appreciate any hints on how to get the cradle to behave more realistic.
as is done in the video, you’ll probably want to "lock" and "unlock" the hinges, via the limits attributes.
if you can’t make it, fake it.
thank you for your quick reply. I have implemented the hinge-locking-and-unlocking like in the example. While this helps with two spheres, I don’t seem to be able to get good results with more than two spheres…
I implemented it like this:
for every collision:
– get the two colliding spheres
– find out which one had the higher absolute x-direction velocity on impact
– lock that one for a specified amount of time
Thanks again for your feedback,
ahh cool, didn’t look to closely at what you were doing.
you might want to permanently lock the middles hinges, or at least only allow a small amount of motion.
if the energy doesn’t transfer to the end balls enough, you could retrieve the impact of each collision, and use that to calculate an impulse to apply to the opposite ball. the impulse value is an entry in the collisions dictionary.
for retrieving collision impulse, check out the following example patch:
thanks again for your suggestion. I implemented the "locking the middle hinges" and right now, it gives funny results. But I guess it can be tuned. (I have not implemented the hack with passing the impulse to the opposite ball) yet.
Alternatively, I made an option that for every collision
* the hitting sphere is A
* the hit sphere is B
– passes on the velocity of A to B
– places A at its resting position
– sets A’s velocity to zero.
This looks a bit jumpy but it is rather realistic. Is there a way to naturally move the sphere to its resting position rather than just ‘teleporting’ it there?
Both options are in the updated patch, in case someone’s curious….
Cheers and thanks!
Forums > Jitter