jit.phys.body infinite movement within a sphere

electron69's icon

Hi,
Sorry for this question but I can't figure out how to accomplish it...
I want just to pick (with the mouse) a jit.phys.body and I want the object bouncing infinitely inside a sphere.

Is this possible?

Any help would be appreciated

All the best,

e69

Rob Ramirez's icon

you should be able to set jit.phys.body @damping 0 0, @friction 0 and @restitution 1, and jit.phys.world @gravity 0 0 0.

then when you send an impulse to the rigid-body, it will bounce forever.

give that a try let me know if it doesn't work.

electron69's icon

Thank you very much Robert!

But doesn't work for me.
Here's the patch from help file.
And is possible to have others shapes of world other than a worldbox?

All the best,

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

e69

Rob Ramirez's icon

ahh yes. the problem is that the planes used in the worldbox are really more of a helper feature. you can't set the material properties on them.
the solution is to create your own world bounds, using jit.phys.body, and setting the properties mentioned above.

eg, in the phys.body help patch, there is a cube shape rigid body that is scaled and positioned to be the "floor"

try using 6 static rigid bodies, instead of the worldbox, and your ball should bounce forever.

electron69's icon

Thanx again Robert!

It works but the sphere begins to accelerated and accelerated until it's start again... Any idea?

Here's the example,

All the best,

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

e69

Rob Ramirez's icon

i think this is just what happens when you set the @restitution to 1. perhaps try setting it to 0.99?

electron69's icon

Same thing, nothing change with @restitution to 0.99....
Press one or two times [impulse 1 1 1] and you will see.
Any idea?

Best,

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

e69

Rob Ramirez's icon

maybe try asking at the bullet forum. bullet is the physics engine used behind the scenes in the jit.phys objects.
http://www.bulletphysics.org/Bullet/phpBB3/

electron69's icon

Ooops, I just found a library PMPD to do that....
I'm sorry but I thought this was much more simple...

Anyway thank you for your answers.

All the best,

e69

ivoryrain's icon

I'm making a beer pong emulation for Kinect in which the ball and rims of the cups are jit.phys.body objects and I am struggling to get the ball to move naturally. There are two issues. There seems to be a significant amount of air resistance even when damping is 0. and the ball rolls across the tops of the cups rather than bouncing even when restitution is set to 1. for both the cups and the ball. Both objects have mass 1. and the cups have kinematic 1. so that they will not move when struck. I would paste the patch but you need the kinect to use it properly. Any suggestions?

Rob Ramirez's icon

hard to say without seeing the patch.
have you tried adjusting the friction values?

try removing the kinect part and replacing it with something like a drunk object before posting it.

ćwiek's icon

looking forward for any news! :)

astromusicologist's icon

Here's a patch in which balls in a box are given an impulse by respective bands of the bark scale (25 bands, 24 of which are divided across each ball; 6 impulses upon each ball for each direction).

Would be really exciting to create this with a sphere, capsule, cone, ice-cream sandwich, etc. whatever shape you would add to the phys.world object - any plans to do so?

bark-output-direct.maxpat
Max Patch