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.
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.
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.
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.
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.
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 :
@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.
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...?
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.
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.