Author Topic: How to fix ScrollView dragItem Lag in 3D world  (Read 6538 times)

Trance_Trap

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 5
    • View Profile
How to fix ScrollView dragItem Lag in 3D world
« on: August 11, 2014, 09:55:38 PM »
http://vimeo.com/103197974

^vid url

Any idea's how how to fix this?

I think it has to do with the UIDragDropItem script OnDragDropMove(Vector delta){} event... but I'm not sure what exactly to do w/delta

Its very simple. Just saved the drag and drop example to a prefab except that its child of a sprite rather than
the root that it was in , in the example.

I just have 1 camera, the main camera, culling Everything so that it can look 3D.

Everything works perfectly except for when I drag the sprite from the scroll view it lags behind
the mouse position. Which obviously isn't ideal :T
« Last Edit: August 11, 2014, 10:14:04 PM by nbr1ninrsan »
One Person can make a difference, and Every Person should Try. ~John F. Kennedy

My avatars' text: "You wouldn't like me when I'm angry... Because I Always backup my rage w/Facts & documented sources" ~The Credible Hulk(he's wearing glasses) ... Lol I just thought it was hilarious ^_^

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to fix ScrollView dragItem Lag in 3D world
« Reply #1 on: August 12, 2014, 06:37:18 AM »
UIDragDropItem was written with 2D in mind, not 3D. The screen space pixel position is simply added to the transform's local position, without any consideration for angle of drag or other 3D-related corrections. You will need to handle dragging differently with 3D. You need to create a plane in OnPress(true), save it, then instead of reacting to OnDrag(delta), do raycasts into that plane in Update(), then update the position of the dragged object by setting the position, rather than by passing the delta.

It's very different from the 2D approach.