jit.phys.picker touch

matmat's icon

hello,
is it possible to have a little example about the touch message in jit.phys.picker ?
thanks

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

sure thing.
let me know if anything is unclear.

matmat's icon

ah yes all is clear;
thank you, this is a great feature !

JMC's icon

Hello,
will it be possible to have the touch message into the jit.gl.picker object in the next update of max6?
Thanks

Rob Ramirez's icon

i've logged this as a feature request.
thanks.

in the meantime, depending on your needs, you could use the phys objects simply for picking.
this will actually pick more accurately than the gl.picker, which uses axis-aligned bounding-boxes for picking.

benoit-1842's icon

is it possible to use it with a jit.gl.model object ?

JMC's icon

@robert
Thanks!
A last thing: as Mathieu Chamagne asked in another thread (https://cycling74.com/forums/using-jit-phys-picker-without-mouse), could the picker objects return the intersection position in the local coordinates of the object that is picked? May be an attribute could enable/disable this feature.

Jean-Michel

Rob Ramirez's icon

hi JMC, i've registered your feature request.
thanks.

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

in the meantime, you can use jit.anim.node worldtolocal message to convert the world position to a local position relative to the rigid-body.
simply attach a rigid-body to a jit.anim.node, and query the phys.picker @position attribute whenever you click on an object.
this is the world-position of the of the click-point. send these values as arguments to the "worldtolocal" message, and you will get the local position values.

mrmorrisplains's icon

i'm a little bit confused about how to click-and-drag on the z axis with phys.picker, it seems different than the option-click method in gl.handle - is there a way to do this?

Rob Ramirez's icon

this is not currently a feature of phys.picker, but consider it a registered feature request.

Rob Ramirez's icon

as of max 6.1, phys.picker will allow you to output the local and world pick coordinates, by enabling @output_positions.

additionally, you can now a selected object into and out of the camera view, by holding down the option key (similar to gl.handle).

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

check the Discussion section of the reference page for more info.

vichug's icon

hello,
for an ongoing project, i need to move gl objects in a scene with the mouse, without having gravity involved. I was thinking getting the mouse coordinates from the fullscreen window, calculate which object of the scene is relatively closer (and in front) of the cursor (i already have the position of each object relative to the camera), then updating coordinates of said object, using the screentoworld and worldtoscreen messages with jit.gl.scene (screentoworld would help translating the mouse on screen coordinates into something inside the gl scene, then worldtoscreen i'm not quite sure).
Then the mouse would be constrained into a plane relative to camera, i mean i have to decide of a 2D to 3D coordinates and was thinking to stay on a 2D plane parallel to the view, and moving the mouse would move the selected object along that plane - a little the same way that you can do with jit.phys.picker.

So my question now : would it be easier to do this using some jit.gl.phys objects ? Because i see that the jit.gl.picker would allow selection of objects the way i need, i don't know though if it can work with each instance of a jit.gl.multiple ; and also i don't know if it would be good seeing that i don't want realistic collisions/gravity.

Rob Ramirez's icon

yes, this is a perfect use for jit.phys objects with dynamics disabled (jit.phys.world @dynamics 0).
meaning you are only interested in picking and collisions on a 3d scene.

jit.gl.picker will only ever work with the axis-aligned bounding box, which in some cases is not precise enough. and it also doesn't currently function with jit.gl.multiple (although that may change in a future update).

you may also be interested in the raytest and screenraytest messages and raytest_mode attribute to jit.phys.world.

vichug's icon

Thanks, i wasn't aware of jit.gl.picker.... when i wrote it, i was meaning jit.phys.picker ! though it might have been indeed cool (maybe not sufficient anyway ?) if gl.picker worked for displaying names of gl.multiple objects. But then, from what i understand, i'll go the jit.phys way.

vichug's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hey Rob,
I triedf to pick with phys objects, but it doesn't seem to want to pick anything when jit.phys.world has @dynamics 0. When i turn it to 1, i can pick everything no problem. From what i could understand, i should be able to pick things with jit.phys.picker even if the world has @dynamic 0, right ? Or is it a max6.1+ only feature ?
Here's the patch, in case i'm missing something :

vichug's icon

(this does not work with max6.1.1)

Rob Ramirez's icon

I'll be away for the next week. I'll have to look at this when I get back. also check out the screenraytest message.

matmat's icon

hi vichug,
may be this can help you...

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

`

vichug's icon

@Rob : ok, thanks a lot for your help
@matmat : it.. sort of... buut, i still would like to be able moving items along the 3 planes - that is, one "plane", the parallel plane to the current view, knowing that the current view will often change. But maybe you can "recenter" the axis of a phys world at any time ? if you could do it relatively to the current view, then you could disable one plane and that would be a solution... depending on how complicated it would be to "recenter" that phys world, it could also be like reinventing the wheel..
Anyway next i'll try things with screenraytest. Thanks, again.

matmat's icon

"@remove_plane 0" on jit.phys.world and you to find your 3 axes...

vichug's icon

@matmat : ... that's a magic i have yet to understand... wonderful.

Franky Redente's icon

Hi Rob, I found this thread while researching a way to add picking functions to a phys.world, using VR hands I'v created via jit.phys.multiple (with your help on the other post)
I would love to implement a similar function like the jit.phys.picker e.g. grabbing and dropping an object in the world using my VR hands ..
I have managed to extract pinch-strength and palm-strength from the hands..i was thinking to use those values to activate a picking feature.. but i am wondering what you think would be the best way/object to use...?

Thank you Rob

F

Rob Ramirez's icon

use the phys.picker "touch" message as demonstrated in the patch i posted at the top of the thread.

Franky Redente's icon

thank you Rob

Franky Redente's icon

Hi Rob, thank you for the reply on this. I have implemented the patch into my world but I am having few problems.
I have also checked the other posts on here.. but still cant really work out a solution.

Problems:
Using the pictslider object to test I noticed it performers better with high values ( 1000 X 1000 ). If i use the 24 24 - world scale values, the touch-contact is not sufficient to move the cube around..like in your example.
Also once the cube is dropped (touch down), I cannot touch it again. Instead I need to reset the cube position to 0 0 0 (via the r key ), activate the touch and then works. My ideal scenario would be to use the pinch values to activate the touch, and the palm position values instead of the pictslider object.
I am using Graham Wakefield's Oculus object to be able to run my Oculus world and the rest.

I have attached a zip file with both my testing patch and Graham Wakefield's Oculus object.

Please could you have a look, I am sure I am doing something wrong..and I would love to know how what exactly.

Thank you so much Rob,

Best

F

for_Rob.zip
zip
Franky Redente's icon

Hi Rob,
I hope you are well. I just found this post re:jit.phys.picker, you were reporting a fault on max 7
https://cycling74.com/forums/how-to-simulate-jit-phys-picker-without-using-mouse/

Is this still broken, I am trying to implement a picking feature into my world with the leap.. but no luck
Thank you

Franky Redente's icon

Rob is working!!! I am so sorry for all this.. i was missing a bang!
All good Rob,