Author Topic: Drag tile, moves faster than cursor (like being offset)  (Read 2959 times)

superme2012

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Drag tile, moves faster than cursor (like being offset)
« on: November 24, 2014, 03:19:03 AM »
Please forgive me if this is already answered and link me please.

I have been busy building a nice DragDrop grid system and all has gone very well implementing NGUI. The only problem I hit and can’t work out is that when dragging the tile, it seems to offset incorrectly.

So it won’t stay under the cursor, it moves correctly but far away from under the curser as its moved.

When dropped it snaps to correct place where the cursor is, but the tile its self moves further when dragged, like its being offset by something. 

Any ideas? Could it be pivot, I got everything centre, middle ( -l) ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag tile, moves faster than cursor (like being offset)
« Reply #1 on: November 25, 2014, 01:11:10 AM »
Sounds like you forgot to multiply the delta by UIRoot's pixelAdjustmentSize.

superme2012

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Drag tile, moves faster than cursor (like being offset)
« Reply #2 on: November 26, 2014, 03:22:08 AM »
I think it could be the scene I’m developing in, I will reconstruct in a fresh scene and then see if it’s different. I did set all the GUI layers to "default" as they somehow picked a layer up from another asset (layer index) that was in the project. Hopefully it’s just that.

superme2012

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Drag tile, moves faster than cursor (like being offset)
« Reply #3 on: November 26, 2014, 04:29:41 PM »
ok see what you mean, OnDragDropMove(delta * mRoot.pixelSizeAdjustment); as a quick fix I set it as OnDragDropMove(delta * mRoot.pixelSizeAdjustment / 2);

works for now.