Forums > Jitter

jit.gl.picker for jit.gl.multiple?

May 7, 2012 | 11:59 am

is there any simple way to do this?


May 7, 2012 | 7:12 pm

not currently, but consider it a registered feature request.

however, you can use the physics objects for this, by linking phys.multiple to your gl.multiple, and turning dynamics off of the physics simulation.

you can then use phys.picker to get the individual instance index.

can you describe more what you are tying to do, and i can come up with a basic example?


May 8, 2012 | 2:14 pm

hi!
so first i am generating the objects positions to fit the whole field of view, using tg(field of view)*depth for maximum x val. than i am converting the real radius and position of the spheres to that what we see from camera view and chech if mouse is over. i dont know how to explain it clearly, abu i am attaching some images, that will show, what i am meaning.

now everything works more or less ok, but my problem is that i want to animate the positions matrix first, and have the opportunity to grab the object and drag it to the other position, and i am stuck..
i hope, that images, and my patch will illustrate my thought clearly :)

– Pasted Max Patch, click to expand. –

[attachment=193266,3840] [attachment=193266,3841] [attachment=193266,3842] [attachment=193266,3843] [attachment=193266,3844] [attachment=193266,3845]

Attachments:
  1. dots06.jpg

May 8, 2012 | 7:02 pm

ok, i would try something like the following patch.
the physics setup involves making the phys.world 2D by setting a value for remove_plane attribute and setting a @filterclass on the picker, and @filter on the phys.multiple to the picker’s filterclass.

the trick is to get the matrix cell position from the instance index reported by phys.picker, and then using that to set the mass value of that instance to 1, so you can drag it.

hopefully this helps you get started with a solution using physics.

– Pasted Max Patch, click to expand. –

May 12, 2012 | 12:20 am

i have created prototype for illustrating the funcionality. can you tell me which way, is the best to get max performance? attached version is done using poly~ and it is slowing down when i am generating too much spheres..
i hope, that patch will work :)

Attachments:
  1. testpoly.maxpat

October 27, 2012 | 12:52 am

Suppose I had many copies of two different phys objects rendered using this same trick. For example two 3×3 matrices each sent to a different jit.phys.multiple, jit.gl.multiple, and jit.gl.gridshape object . I would then have 9 spheres and 9 cubes in my phys world. Could I then use a picker (or perhaps two pickers?) to identify whether the object I click on is a cube or a sphere?


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