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
micron

– 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…
Thanks


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.



JMC
January 22, 2013 | 11:04 pm

+1

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.

Jean-Michel


January 25, 2013 | 1:40 pm

+ 1 !

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

Mathieu


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?

<code>

– Pasted Max Patch, click to expand. –

</code>


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.


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