playMaker

Author Topic: Drag and drop object with exact position in 2D  (Read 1022 times)

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Drag and drop object with exact position in 2D
« on: July 24, 2023, 04:26:46 AM »
Hi all,

i'm having issues making a drag and drop system in 2D with perfect position. As you can see in the gif below, the object does not follow the cursor properly, i.e. cursor moves faster than the object i am dragging.

https://gifyu.com/image/ScS8B

Here's the setup for dragging:



Offset is used so i the object is not centered to the cursor every time i click on it. Instead, i use the offset so the object is dragged from the point i click ok. It is not causing the issue since the issue is present without the offset too.

Edit: Sorry, a small error in the screenshot, set position is using ScreenX and ScreenY calculater from the screen to world point.
« Last Edit: July 24, 2023, 04:36:35 AM by Fat Pug Studio »

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Drag and drop object with exact position in 2D
« Reply #1 on: July 24, 2023, 04:59:47 AM »
Ok, i was overly complicating it, basically converting the mouse x and y from screen to world gets it working properly, i just have the issue of the picked object "jumping" to cursos. Any ideas on that one?