Author Topic: DragItem in world space  (Read 2321 times)

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
DragItem in world space
« on: June 04, 2012, 01:27:52 PM »
Hi,

I copied the DragDropItem script for use in my game but now when I drag the item does not follow the mouse correctly. How can I convert the OnDrag event to use world space coordinates instead of screen space?

Thanks!

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: DragItem in world space
« Reply #1 on: June 04, 2012, 02:41:47 PM »
In testing I found that it works correctly if UIRoot is set to Automatic. Setting UIRoot to manual means the delta passed in from OnDrag is not correct. How can I adjust this value so it will work with my UI.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: DragItem in world space
« Reply #2 on: June 04, 2012, 03:04:31 PM »
Just account for UIRoot.manualHeight / Screen.height.

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: DragItem in world space
« Reply #3 on: June 04, 2012, 03:46:44 PM »
Works perfectly. Thank you!