jit.phys.multiple reposition but forces are reset
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
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
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.
Ok, maybe in the next update it would be a new feature, now I tank you for reply.
+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
+ 1 !
I'm really missing a simple way to change individual bodies position in jit.phys.multiple ...
Mathieu
ok guys, i'll see what i can work out for a future update.
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.
Very interesting patch ROB, I missed this set sendbody thing!!
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?
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.
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
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 jit.gl.mesh, but you can simply replace with your jit.phys.multiple:
i created a wiki page to further explain this:
https://cycling74.com/wiki/index.php?title=Position_Rotation_and_Scaling_on_Matrix_Data
Thank you so much Rob! I will try it out !
Best
F
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..
https://cycling74.com/wiki/index.php?title=Position_Rotation_and_Scaling_on_Matrix_Data
...but again no happy ending. You are sending [s draw] from jit.world ..but I am using a jit.phys.world, and this does not have a draw outlet.
would you please elaborate more on this.
Thank you so much
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.
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 ..so thank you so much, i learned a lot in the past 2 days.
F