Author Topic: DragDrop item inversed if panel is enabled, works fine if panel is disabled  (Read 6418 times)

divKaran

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 2
    • View Profile
Hi,

I am trying to create a game in which the I have to drag some widgets. Often the widgets are dragged in inverse direction and hence behave vaguely. From what I have noticed, if the main panel in which those widgets lie is disabled, then it works fine (when I play the game and the panel gets active)... otherwise they behave strangely (inverse drag). They move in the opposite direction of my finger drag on the screen.


Also, I have two panels one of which is rotated by 90 degrees in Z.  Again the same thing happens with this panel as well, if the panel is disabled and then I play the game and it gets active then the drag of the widgets inside the panel is fine.

toyob

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 7
    • View Profile
Please provide details on how you exactly implement the dragging, so I could help you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
NGUI's dragging isn't meant to work with a rotation from what I recall. Remove that 90 degree rotation. Rotation must remain 0.

divKaran

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 2
    • View Profile
But that is a requirement that I can't compromise with. Also, the rotation has been applied to the parent of the game object on which the drag has been applied and not to the drag game object itself. Please let me know if there is any work-around for this.  Thank you :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
The UIDragDropItem's OnDragDropMove function already considers rotation: mTrans.localPosition += mTrans.InverseTransformDirection((Vector3)delta);

That said, I don't think I've done much testing, or ever had a single use case for why a rotation would be necessary for this to begin with. What is your actual reason for requiring it?