jit.phys ball rolling within a ball maracas

Martin Daigle's icon

Hello! I have been working on a patch that allows me to make a maracas where a ball rotates within a ball. I am well underway; however, I have a few issues.

1 - Sometimes, the small ball falls outside of the concave jit.phys.body. I want this body to remain in place for the small ball to remain within its bounds.

2 - I want to create (and increase) force around the edge of the large circle that will lead my ball to rotate around the edge. I tried with 4 jit.phys.ghost objects; however it really does not work as intended.

GesturalCircleControl.maxpat
Max Patch

Thanks for your help!

TFL's icon

I couldn't make your patch work as is, but after a few corrections based on this patch, it works! Another good example is Day 7 of Physics patch a day tutorial.

For some reason it works better with dynamicmesh than concave which seems buggy somehow.

Max Patch
Copy patch and select New From Clipboard in Max.

Martin Daigle's icon

Hey TFL !

This looks amazing!

I made some adjustments which might help see the direction where this is going.!

would you have any ideas on getting the force to run smoother along the walls of the sphere? when I speed up the force of the jit.phys.ghost on the bottom left, there are many bumps in the road.

and sometimes the ball flies out.. but that's much more ok! :)

thanks for your help!

GesturalCircleControl.maxpat
Max Patch

TFL's icon

Check [jit.phys.world] fixedtimestep an maxsubstep attributes for better accuracy, and ultimately numthreads for the performance. It might help solving all your problems.

You don't have a [jit.phys.world] object in your patch but you can use the one builtin [jit.world] using sendphys messages as you might already know.

Also, please avoid attaching your patcher file here. It's better to select your objects and Edit > Copy Compressed, and paste here (easier for us so we don't have to download the file and delete it afterward).