Author Topic: UIPanel movement appears to be Integer based  (Read 5303 times)

JasonABentley

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
UIPanel movement appears to be Integer based
« on: August 03, 2014, 01:55:29 PM »


I have an Object with a UIPanel and UIRoot.  Under that I have two sprites.

When I move the UIPanel object, in code by moving the transform's local position, it appears to move fine but the underling sprites move as if the UIPanel's position was integer based.  IE: they 'pop' from position to position.

I'm lerping between a Vec3( -53, 41, 0) and Vec3( -51, 41, 0) and in code this works fine.  Transitioning from -53 to -51 over time, but the visiuals look as if it popped from -53 to -52 to -51 without hitting any points inbetween.

Any one have any suggestions?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #1 on: August 04, 2014, 09:37:00 AM »
I vaguely recall there being some logic that snaps to pixels like that... I know there is logic like that whenever you happen to move sprites in the scene view, but it doesn't kick in for manual transform manipulation. I don't remember if there's something that snaps panels or not. Why though? How can you notice this? 1 unit is 1 pixel.

JasonABentley

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #2 on: August 05, 2014, 06:45:57 AM »
The UIPanel Transform in my project snap to a scale of (0.002777778, 0.002777778, 0.002777778) when it was first created, so 1 unit is definitely not 1 pixel.

Is that perhaps the root problem?

I've tried setting the scales on the UIPanels to 1, but it's just reset back to .0027 while the UIRoot is enabled.

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #3 on: August 05, 2014, 06:52:54 AM »
The UIPanel Transform in my project snap to a scale of (0.002777778, 0.002777778, 0.002777778) when it was first created, so 1 unit is definitely not 1 pixel.
Actually, that looks like a precisely correct scale for a 360px screen. Provided the camera sees only one unit area, any child of a root scaled like that will have 1:1 unit to pixel scale.

JasonABentley

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #4 on: August 05, 2014, 08:05:31 AM »
Moving the Sprites underneath directly works correctly, but they have to move rather fast so there is some screen tear occasionally.

I've read that moving the UIPanel directly incurs little, to no, over head when being moved so I've been attempting it but I'm getting the above issue.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #5 on: August 05, 2014, 01:50:09 PM »
UIRoot (also optionally UIPanel, transform scale of 2 / Screen.height)
- UICamera
- UIPanel (secondary panel that you will move)
-- Your UI elements

JasonABentley

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UIPanel movement appears to be Integer based
« Reply #6 on: August 05, 2014, 05:05:33 PM »
Yup; that explains the problem.  I definitely had it built with multiple UIRoots (which I obviously didn't need)

Thank you!