Dragging buttons

Hi, I need help with this simulation of a projector : https://cospac.es/M3l8
I would like each of the 3 buttons to remain on their axis when moved with the mouse.

Thank you for your help.
Daniel Pers, STEM teacher in France

Hi @Daniel_Pers,
i didn’t know about the internal function addMoveCollisionInteraction()

I found some info from @Stefan in the forum… nice to know…
it seems the function retains priority over the object’s position during the dragging…
only when you release it, your object is re-positioned along its axis.

i believe it’s something not easy to overcome, unless there was an undocumented callback function available…

Another attempt should be to have two objects, one transparent that you actually are dragging and one visible, constantly maintained in-axis (you can code it as you ca code the dog position in the Stefan’s example…)
When you release the dragging, the transparent is repositioned again…

Hi @Daniel_Pers,

I modified your space, so the buttons remain on the axis. You can remix the scene and work with it.
I added three transparent cuboids that limit the drag area and modified the code in the script path.

Hope that helps

Hi @Nikolay, thank you very much for your help, but I can’t see your code or remix your scene.

I updated the sharing settings. Should work now.

Thank you @Nikolay. I deleted my axes and used your cuboids (in gray) as axes for the buttons. I can now continue my modeling work which I share the link: https://cospac.es/J6VR

2 Likes

setSurfaceDrag… another undocumented internal feature/function?!?

I wonder how many of them are available and how many marvellous things we could do :slight_smile:

Is there a place where to collect them? setSurfaceDrag wasn’t in any forum posts…