jit.phys.multiple reposition but forces are reset

    Mar 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

    • Mar 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
    • Mar 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.
    • Mar 25 2012 | 9:20 pm
      Ok, maybe in the next update it would be a new feature, now I tank you for reply.
    • Jan 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.
    • Jan 25 2013 | 1:40 pm
      + 1 !
      I'm really missing a simple way to change individual bodies position in jit.phys.multiple ...
    • Jan 25 2013 | 10:04 pm
      ok guys, i'll see what i can work out for a future update.
    • Mar 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.
    • Sep 08 2013 | 12:50 pm
      Very interesting patch ROB, I missed this set sendbody thing!!
    • Sep 13 2013 | 4:38 pm
      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?
    • Sep 13 2013 | 7: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.
    • Oct 12 2015 | 9: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
    • Oct 13 2015 | 5:58 pm
      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:
    • Oct 13 2015 | 6:26 pm
    • Oct 13 2015 | 7:05 pm
      Thank you so much Rob! I will try it out !
    • Oct 15 2015 | 12:54 pm
      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
    • Oct 15 2015 | 12:57 pm
    • Oct 15 2015 | 8: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.
    • Oct 16 2015 | 2:50 pm
      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.