Forums > Jitter

Apr 29 2013 | 1:00 pm

Dear max-forum-members,

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.

Best regards,
Hanna

###### Attachments:
1. theworld.js
Apr 29 2013 | 10:18 pm

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.

Apr 30 2013 | 9:52 am

Hi Rob,

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

Hanna

###### Attachments:
1. theworld.js
Apr 30 2013 | 4:24 pm

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:
Max 6.1/examples/jitter-examples/render/physics/phys.world.collision.impulse.maxpat

May 01 2013 | 9:04 am

Hi Rob,

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!
Hanna

###### Attachments:
1. theworld.js
Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Jitter