Forums > Jitter

jit.phys.picker touch

December 30, 2011 | 11:41 am

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


December 30, 2011 | 4:13 pm

sure thing.
let me know if anything is unclear.

– Pasted Max Patch, click to expand. –

December 31, 2011 | 8:57 am

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



JMC
September 13, 2012 | 2:43 pm

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


September 13, 2012 | 4:17 pm

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.


September 14, 2012 | 2:51 pm

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



JMC
September 14, 2012 | 9:44 pm

@robert
Thanks!
A last thing: as Mathieu Chamagne asked in another thread (http://www.cycling74.com/forums/topic.php?id=36348), 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


September 17, 2012 | 6:20 pm

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


September 17, 2012 | 7:29 pm

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.

– Pasted Max Patch, click to expand. –

November 8, 2012 | 3:56 pm

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?


November 9, 2012 | 10:02 pm

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


March 19, 2013 | 9:09 pm

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).

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

– Pasted Max Patch, click to expand. –

March 20, 2013 | 2:17 pm

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.


March 20, 2013 | 5:52 pm

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.


March 20, 2013 | 7:06 pm

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.


March 21, 2013 | 11:11 am

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 :

– Pasted Max Patch, click to expand. –

March 21, 2013 | 5:03 pm

(this does not work with max6.1.1)


March 21, 2013 | 8:33 pm

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.


March 21, 2013 | 9:27 pm

hi vichug,
may be this can help you…

`

– Pasted Max Patch, click to expand. –

March 22, 2013 | 3:00 am

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


March 22, 2013 | 9:22 am

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


March 22, 2013 | 1:54 pm

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


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