Author Topic: DragDropItem + UICamera Rotation Issue  (Read 8322 times)

Avagantamos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
DragDropItem + UICamera Rotation Issue
« on: September 07, 2016, 10:24:48 AM »
Hello!

I have encountered an issue with the DragDropItem script when rotating the camera -180 degrees on the Z axis (essentially flipping the screen).  When the player attempts to drag an item while the camera is at this position the item moves in the opposite direction of the cursor. 

For example if I drag an item up and to the left it will drag it down and to the right.  The cursor with be at the correct position but the item will essentially be in the opposite location.  I have tried using a multiple camera setup and it still doesn't seem to respond correctly.  I have also tried messing with every camera setting available.  I feel like this is something simple that I'm just missing.   

Any help would be greatly appreciated!
« Last Edit: September 07, 2016, 12:25:31 PM by Avagantamos »

Wisteso

  • Full Member
  • ***
  • Thank You
  • -Given: 21
  • -Receive: 3
  • Posts: 103
    • View Profile
Re: DragDropItem + UICamera Rotation Issue
« Reply #1 on: September 07, 2016, 03:28:13 PM »
Can you not rotate the interface instead? Just curious.

I dont think the issue is NGUI since it's probably just relying on Unity functions to provide the position data.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: DragDropItem + UICamera Rotation Issue
« Reply #2 on: September 09, 2016, 02:22:11 PM »
Check the UIDragDropItem's OnDragDropMove function. It simply appends delta to the local position. If you want it to respect rotation, you should override that function with something that will do a transform direction like UIDragScrollView does:
  1. var delta3 = (Vector3)delta;
  2. mTrans.localPosition += mTrans.InverseTransformDirection(delta3);