Author Topic: OnDrag doesn't work correctly when UIRoot.Automatic is false  (Read 3537 times)

citizen12

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
OnDrag doesn't work correctly when UIRoot.Automatic is false
« on: August 20, 2012, 10:59:09 PM »
I have a setup where my UIRoot Automatic checkbox is OFF.  I am also using an OnDrag handler similar to DragDropItem where I use the delta parameter to update my object's localPosition:

  1.                                 mTrans.localPosition += (Vector3)delta;
  2.  

The problem I am seeing is that the drag is being scaled by a multiplier that causes the item to move further than the total number of pixels i have moved the mouse pointer.  When I have moved the mouse 2 pixels the underlying object has moved 3.  When I have moved the mouse 50 pixels, the underlying object has moved 60.  At 100 it's about 150.

When I check the Automatic setting in UIRoot, the movement works correctly and the underlying object moves exactly the same amount as my mouse movement.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnDrag doesn't work correctly when UIRoot.Automatic is false
« Reply #1 on: August 21, 2012, 12:29:23 AM »
This is correct. OnDrag is always in pixels. You have to adjust by the UIRoot's size yourself if you want it to be relative to the UIRoot's size property.