playMaker

Author Topic: drag and drop for puzzle mechanic  (Read 3526 times)

TerraImagina

  • Playmaker Newbie
  • *
  • Posts: 33
drag and drop for puzzle mechanic
« on: December 17, 2019, 10:20:56 AM »
Hello,
I would like to have an action for drag and drop, with some customisations, like being able to constrain the drag to some specific aera (x, y constrain), or being able to drag a piece to a target for puzzle mechanism. with event like on drag start, on drop sucess (if droped close to the target), on drop fail...
The drag and drag and drop is something quite important for my project.
To be able to make puzzle game, or to be able to drag the camera on the x axis with finger...
Thank you

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: drag and drop for puzzle mechanic
« Reply #1 on: December 17, 2019, 11:56:53 PM »
Hi.
This can not be done in a single action.

for drag and drop you can have a look at this tutorial, maybe it can help


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: drag and drop for puzzle mechanic
« Reply #2 on: December 18, 2019, 12:58:50 AM »
Hi,

 also, check the drag and drop sample on the ecosystem is features drop slot locking option which will help you understand how you can start creating complex drag and drop behavior.

 as for positin constraint, it's independant from the dragging, so work on that separatly and once you have some experience on this integrate it in your drag behavior. I would say that within the context of UI you could create a panel acting as the boundary and then move the drag object using normalized coordinate within this panel ( the drag object would be parented), or possibly using some rect intersect checks instead.

Bye,

 Jean

TerraImagina

  • Playmaker Newbie
  • *
  • Posts: 33
Re: drag and drop for puzzle mechanic
« Reply #3 on: December 18, 2019, 07:17:22 AM »
Thank you. The video is a bit advance for my understanding but I will watch it again this evening and try to make my logic out of it. cheers

TerraImagina

  • Playmaker Newbie
  • *
  • Posts: 33
Re: drag and drop for puzzle mechanic
« Reply #4 on: December 18, 2019, 04:08:28 PM »
Sorry jeanfabre I feel quite noobs, but I can not find the drag and drop sample in the ecosystem, only sample I found was drag and throw which doesnt have the mechanic you mention. How can I find the sample ?
(I typed drag and checked for sample packages on the ecosystem)
Thank you

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: drag and drop for puzzle mechanic
« Reply #5 on: December 19, 2019, 02:04:11 AM »
Hi,

 oh right sorry!, I need to port them back... It's done, you can now find it in the ecosystem :)

https://twitter.com/JeanAtPlayMaker/status/585083557451796480

my bad... I 'll have some spare time at the end of this month, I'll port the rest of the UI samples I have and port them to use the built in UI support of playmaker, right now these samples were made with the first take on UI support which was not official, so it has many custom components, etc etc. now, it's all built in Playmaker.

Let me know how it goes.

Bye,

 Jean

TerraImagina

  • Playmaker Newbie
  • *
  • Posts: 33
Re: drag and drop for puzzle mechanic
« Reply #6 on: December 19, 2019, 02:57:31 PM »
Thank you, I found it and it work well. (need to install translate advanced in the ecosystem as well)
It is really interresting to see how it is done, a good way to learn from advance user ! I wonder if it work for 3D objects (I plan to do a 3D puzzle game) or only for canvas elements.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: drag and drop for puzzle mechanic
« Reply #7 on: December 20, 2019, 02:43:11 AM »
Hi,

 ok, fixed the package, the missing action will be there now.

 as for 3d, yes, you can use the same logic and callbacks, by replacing the Graphic Raycaster by a PhysicsRaycaster and then all you your UI system events will be working.

Bye,

 Jean

TerraImagina

  • Playmaker Newbie
  • *
  • Posts: 33
Re: drag and drop for puzzle mechanic
« Reply #8 on: December 20, 2019, 04:53:22 AM »
That is great ! Thank you so much for all the infos !