playMaker

Author Topic: UGUI Drag & Drap Sample Question  (Read 2244 times)

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
UGUI Drag & Drap Sample Question
« on: August 23, 2017, 12:54:34 AM »
Hi,

I am trying to use UGUI drag and drop in my game. The example in our Ecosystem works great with the Canvas Render Mode set to be Screenspace -Overlay. However, I need to set it to be Screen Space - Camera or World Space. Is it possible to do that?

Once I drag the game object, the image would disappear and it shows up again when I drop it in the target spot. Can someone help me with it?

Thanks.
« Last Edit: August 23, 2017, 01:25:43 AM by Wayne191 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: UGUI Drag & Drap Sample Question
« Reply #1 on: August 23, 2017, 02:59:28 AM »
Hi,

 Yes it's possible to do that, but the way the Ui element moves as you drag it needs to be updated I think, because it was only assuming the 2d flat rendering mode.

I am currently wrapping up an animator Demo, I'll get on this right after. Please ping me end of week if I haven't come back to this thread :)

 Bye,

 Jean

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
Re: UGUI Drag & Drap Sample Question
« Reply #2 on: August 23, 2017, 04:25:59 AM »
Thank you Jean. I'll PM you.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: UGUI Drag & Drap Sample Question
« Reply #3 on: August 25, 2017, 04:42:25 AM »
Hi,

 Ok, I have done the drag sample mods and made a new one with Canvas set to World Space.

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


 Check it out, Let me known if you understand how it's been done, basically:

-- you need to RectTransformScreenPointToWorldPointInRectangle action to properly convert the screen pointer position to the world inside the canvas

-- the other to be considering is now that dragging is not done using a delta movement, you need to take in account the initial offset between the dragged element position and the pointer position, and always substract that when dragging and so your dragged element will not jumped under your pointer when dragging.


Bye,

 Jean

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
Re: UGUI Drag & Drap Sample Question
« Reply #4 on: August 27, 2017, 11:54:17 PM »
Hi,

Thanks Jean for your help.

I am experimenting with it. Will let you know.  :)

cper

  • Playmaker Newbie
  • *
  • Posts: 17
Re: UGUI Drag & Drap Sample Question
« Reply #5 on: May 23, 2021, 06:26:22 AM »
Hi Jean,

I couldn't find the uGuiDragInWorldSpace in the Ecosystem, also the sample you shared on twitter is only drag in World space. How about Drag in Screen space -Overlay? as the initial sample was demo only in Screen space overlay and doesn't work in Camera.

Please help.

Thank you

RPM37

  • Playmaker Newbie
  • *
  • Posts: 2
Re: UGUI Drag & Drap Sample Question
« Reply #6 on: April 17, 2023, 03:25:15 AM »
Hey Jean. Saw your example tweet and that is exactly what I’m trying to do with my own game by dragging 2D images in a Canvas set to World Space. Can you share how exactly you set the FSMs to accomplish that.

Thanks!

Hi,

 Ok, I have done the drag sample mods and made a new one with Canvas set to World Space.

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


 Check it out, Let me known if you understand how it's been done, basically:

-- you need to RectTransformScreenPointToWorldPointInRectangle action to properly convert the screen pointer position to the world inside the canvas

-- the other to be considering is now that dragging is not done using a delta movement, you need to take in account the initial offset between the dragged element position and the pointer position, and always substract that when dragging and so your dragged element will not jumped under your pointer when dragging.


Bye,

 Jean