Forums > Jitter

jit.phys.multiple reposition but forces are reset

March 23, 2012 | 12:33 pm

Hi, I’m working on jit.phys.multiple with some spheres,
I would like when some sphere go near floor they are repositioned at the top
I’m sending a position matrix to jit.phys.multiple but when it move my sphere all forces on the other spheres are reset.
Is there a way to repos keeping forces or get a force matrix from jit.phys.multiple?
Thanks for help

— Pasted Max Patch, click to expand. —
March 25, 2012 | 8:55 am

Now I’m using poly~ and simple jit.phys.body so I can control the position of single sphere without reset forces into other, but if someone know a better way…

March 25, 2012 | 8:52 pm

unfortunately, this is currently unavoidable with phys.multiple.
setting the position of a phys.body removes all acting forces on the body (as you’ve discovered), and there’s no way to set the position of only a single instance of a phys.multiple.

i will take a look at possible workarounds for this, but in the meantime, poly~ or javascript are the ways to go.

March 25, 2012 | 9:20 pm

Ok, maybe in the next update it would be a new feature, now I tank you for reply.

January 22, 2013 | 11:04 pm


I’ve got a project with hundreds of bubbles falling down, and I need to reposition them one by one at the top when they go offscreen.

Will it be possible to have something similar to the setcell message of jit.matrix (setcell i j val x y z) , send to the position_matrix inlet. The best will be to have this behavior for any matrix inlet.


January 25, 2013 | 1:40 pm

+ 1 !

I’m really missing a simple way to change individual bodies position in jit.phys.multiple …


January 25, 2013 | 10:04 pm

ok guys, i’ll see what i can work out for a future update.

March 19, 2013 | 9:04 pm

hey guys, as of max 6.1 there are two new messages to phys.multiple: sendbody and sendbody_reset
they both allow you to send messages to individual body instances of the phys.multiple, thereby allowing you to change the position of a single body without affecting the other bodies.

sendbody_reset will reset all the forces on the body prior to sending the message.
check the reference page for more info.

here’s a basic patch.

— Pasted Max Patch, click to expand. —
September 8, 2013 | 5:50 am

Very interesting patch ROB, I missed this set sendbody thing!!

September 13, 2013 | 9:38 am

Hey Rob, I am trying to integrate this new "sendbody" message into the following patch. It is a patch from our friend Sam Tarakajian. His original patch had an issue with gravity being reset when an objects physparams are set.

I want to use sendoby to set force but do know how to get body names.
Any ideas?


— Pasted Max Patch, click to expand. —


September 13, 2013 | 12:18 pm

you probably first want to enable @local_scaling on your phys.multiple object.
this will allow you to send the scale matrix values (as you’re currently doing each frame), without causing a body reset.

then, you simply plug the pak you’ve created into the phys.multiple.
you set the body using position matrix cell index.
so in your example, you have a position matrix of dimension 100, so you would use 0 to 99.
if your position matrix was 10 10, it would be 0 0 to 9 9.

you can alternatively send to bodies using the body name. the body name is the phys.multiple name (set using the @name attribute) followed by an underscore and the cell index.
eg: pmult_0 to pmult_99, or if it’s 2d, pmult_0_0 to pmult_9_9

the phys.picker will output this name when clicking on phys.multiple bodies, as demonstrated in the patch i posted above.

October 12, 2015 | 2:57 am

Hello Rob, thank you for this. I am working on a Max/Msp/Jitter projects using the Oculus Rift and Leapmotion device.
I have just managed to make both Leapmotion hands using your method. Thank you.
– two jit.phys.multi (25 bodies each object)
– each body receive position from the leapmotion

problem :
I will need to offset both hands (both jit.phys.multi) by the Oculus position and quat coordinates.
In the past I have used a jit.anim.node method so that the hands would follow the Oculus position and quat.

But seems that the jit.phys.multi does not respond to any jit.anim objects.
Could you please advice me on a possible solution for sending position and quat to jit.phys.multi (all bodies)?

Thank you, I have attached the patch

  1. manomulti.maxpat
October 13, 2015 | 10:58 am

you can send your phys.multiple position matrix through the following jit.gen patch, in order to perform position, rotation and scaling on the values. the patch below demonstrates using, but you can simply replace with your jit.phys.multiple:

— Pasted Max Patch, click to expand. —
October 13, 2015 | 11:26 am
October 13, 2015 | 12:05 pm

Thank you so much Rob! I will try it out !



October 15, 2015 | 5:54 am

HI Rob,

I have tried implementing your patch into mine, unfortunately is not working.
Your example using the mesh is working fine, but when I use it with a jit.phys.multiple.. the jit.gen is not performing right.

It resets all the single bodies rather then moving them by keeping the different values coming from the leapmotion (forming the hand shape – see screen shot)

I have attached a patch which demonstrate that, please could you check it and let me know if i am doing something wrong?
I have also tried the anim patch you have included here..
…but again no happy ending. You are sending [s draw] from ..but I am using a, and this does not have a draw outlet.

would you please elaborate more on this.

Thank you so much

October 15, 2015 | 5:57 am

here a screen shot

  1. Screen-Shot-2015-10-15-at-13.36.36


October 15, 2015 | 1:05 pm

a few problems with your patch. your position matrix was only 1 plane when it should be 3, for the xyz positions. you should also enable @kinimatic 1 on you phys.multiple when controlling the position of phys bodies in this way.

the sendbody message will override the input matrix positions values, so you can’t use that in the way you are attempting. instead simply use the setcell message to jit.matrix to set the position values directly on the position matrix. this matrix can then be transformed by the jit.gen object to add in the quat and position offsets.

— Pasted Max Patch, click to expand. —
October 16, 2015 | 7:50 am

Hi Rob, thank you so much! I have now implemented the code you have suggested into the patch.
It works great, I am so happy thank you so much, i learned a lot in the past 2 days.


Viewing 19 posts - 1 through 19 (of 19 total)

Forums > Jitter