How to simulate jit.phys.picker without using mouse?

Masa's icon

I tried to accomplish the behaviour of jit.phys.picker by changing the position of jit.phys.body, but the behaviour is different. When you set the shape of jit.gl.gridshape to cube, you can see the crazy rotation of the cube caused by drastic mouse movement, but it won't happen by changing the position values.
How would you simulate the jit.phys.picker behaviour without using mouse?
My current goal is to achieve the similar effect of jit.phys.picker via Leap Motion.

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

Many thanks for your help in advance,
Masa

Rob Ramirez's icon

you can simulate phys.picker by attaching a phys.point2point constraint to your phys.body changing the position2 attribute.

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

however, a better solution for the leap, is to use the phys.picker "touch" message. unfortunately i am just now realizing that this is broken in max 7. if you want to use max 6, you can at least check out the functionality:

i will make sure the touch message gets fixed for the next release.

Masa's icon

Thanks a lot for your great advice Rob!
OK, I will get back to Max 6 for this project, while looking forward to the next release.

Masa's icon

I found that the "touch" message for jit.phys.picker uses x and y information for pseudo 3d mapping. I would like to make use of the z information of Leap Motion. I would appreciate any suggestion.

Rob Ramirez's icon

then yes, you probably just want to create a phys.point2point constraint, and use the leap values to control its position.

you will want to offset the constraint from the center of the phys.body using @position1, in order to get the swinging around effect.

Masa's icon

phys.point2point seems perfect! Thanks a lot Rob.

Masa's icon

I am using the grabbing action of Leap Motion as a hold-down (click) action of jit.phys.picker. Basically I'd like to switch between the state of being controlled by my hand and the state of being controlled by gravity.
When phys.point2point is connected, it seems that the object is ignoring gravity. Is there any way to switch between the states?

Many thanks,
Masa

alain's icon

Hello,
I'm joining this post because I'm beginning to work on a similar project.

I want to interact with 3D cylinders with Leap Motion to create selection tools, like "pickers" in iOS :
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/UIKitUICatalog/UIPickerView.html

I'd like to make cylinders rotate on only one axe, in two directions, just "touching" them with Leap Motion.

I'm a beginner with OpenGL, I red some posts here, and I understand I'll need to use "jit.phys.picker" ; Leap Motion external from Ircam.
But I'm wondering how to :
- make Leap Motion replace mouse actions with jit.phys.picker ?
- use the "touch" message Rob mentionned earlier ?
- make sure the cylinder just rotate on the axe I choose and not move around freely ?

Thanks for any help.
Alain

Rob Ramirez's icon

specifically the 3D-Picking-example patch.

alain's icon

Thanks Rob,
Now I have to study this, but I think I understood the logical.

By the way, have you a suggestion to make the object touched by the "jit.phys.3dpicker" just rotate on an axe and not move around freely ?
Is there a way to anchor it ?

Thanks again,
Alain

alain's icon

I test quickly with the "jit.phys.point2point" object, I can anchor my cylinder in space.
In this case, when "touching" it with Leap Motion, it doesn't move around, but rotates in all axes.
Now I'm wondering how to make it rotate only on one axe...

Rob Ramirez's icon

use a different constraint, such as jit.phys.hinge

alain's icon

Great !
At first sight It looks ok.

Thanks !