Welcome to %s forums

BrainModular Users Forum

Login Register

Collision question

I need help on a Patch
Post Reply
ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 07 Aug 2017, 22:42

Hi gang,

I'm creating a 4 x 4 button grid where, "dragging and dropping" one button over another, copies its properties. I figured the best way to do this is use the collision property to determine which button is being dragged over. It doesn't seem to work for me. Collisions are not detected.

I've studied the GROOVE Physics patch and it shows the same problem. As soon as I set physics speed and gravity to 0 (to get my buttons to stay still), collisions are no longer detected.

Any suggestions? I'm open to another approach as well. Thanks.
Regards,

Scott

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 08 Aug 2017, 00:03

not sure i fully got it understood and what is meant by 'copy proprieties', but here is how i would do personally, not using physics, if it can be an evently spaced 'matrix':

create a container, layout the 16 cellz (buttons) in the container, ordered from top left to botom right. collect all the mouse down output of buttons in an array. so when a button is clicked, checking the max position in the array returns the id of the clicked cell. thats the 'source', then i would make a virtual grid, a computation relating current mouse X,Y position in container returning wich cell id mouse is currently over, this is the 'target', so when draging a button we know wich cell is under.
then on mouse down, from 0 to 1, get the desired 'propriety' for ex a value in an array, and when mouse is up, from1 to 0, copy this to the target, ie set array element value.

here is an exemple where i used polyphonic patch to go quicker, but hope can get the idea:

http://www.sensomusic.org/forums/upload ... t_mx00.wkp

ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 08 Aug 2017, 00:13

23fx23, this is EXACTLY what I am trying to do. Thanks!

I'll study what you've done.
Regards,

Scott

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 08 Aug 2017, 00:54

ok cool. in fact ive figured out this can be simplified, instead of collecting mouse down to array and get max array, can use the virtual grid id computation used for target and pass the id only on mouse down , will save tiny bit of cpu. here is an updated version, and ive linked all the stuff so can change the numbers of cols or rows and contenair size and all should follow automatically in case:
http://www.sensomusic.org/forums/upload ... t_mx02.wkp

ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 08 Aug 2017, 00:59

Thanks. Out of curiosity, did you work up this example to answer my question, or was it something you had previously done?

On a related note, why not use the collision property? Isn't this what it's for?
Regards,

Scott

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 08 Aug 2017, 01:12

ive worked a lot with matrixes by the past and did relatively similar stuff already yes so was quick, wanted to try back because ive seen a 'mouse over' new feature on HH3, but sadly its not availabe as pin yet on all modules so couldn't use what i had in mind, also because personnaly i would like to see the 'cell' going back to its original position once dropped, but there are often many ways to do a thing in usine, my feel was its prob lighter to compute id from XY than using physics engine, but maybe it can be done that way too. from what i understand collision was more for a 'simulation' running with gravity as pointed rather than manually moving objects, but maybe its a possible interesting solution/suggestion, have to try

ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 08 Aug 2017, 01:25

Well your examples are nicely done. Thanks for your help.
Regards,

Scott

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests