Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: divKaran on July 20, 2017, 06:08:53 AM

Title: DragDrop item inversed if panel is enabled, works fine if panel is disabled
Post by: divKaran on July 20, 2017, 06:08:53 AM
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.
Title: Re: DragDrop item inversed if panel is enabled, works fine if panel is disabled
Post by: toyob on July 20, 2017, 06:17:17 AM
Please provide details on how you exactly implement the dragging, so I could help you.
Title: Re: DragDrop item inversed if panel is enabled, works fine if panel is disabled
Post by: ArenMook on July 22, 2017, 02:52:52 PM
NGUI's dragging isn't meant to work with a rotation from what I recall. Remove that 90 degree rotation. Rotation must remain 0.
Title: Re: DragDrop item inversed if panel is enabled, works fine if panel is disabled
Post by: divKaran on July 30, 2017, 10:18:56 PM
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 :)
Title: Re: DragDrop item inversed if panel is enabled, works fine if panel is disabled
Post by: ArenMook on August 03, 2017, 03:59:06 AM
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?