Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: JasonABentley on August 03, 2014, 01:55:29 PM

Title: UIPanel movement appears to be Integer based
Post by: JasonABentley 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?

Title: Re: UIPanel movement appears to be Integer based
Post by: ArenMook 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.
Title: Re: UIPanel movement appears to be Integer based
Post by: JasonABentley 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.
Title: Re: UIPanel movement appears to be Integer based
Post by: bac9 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.
Title: Re: UIPanel movement appears to be Integer based
Post by: JasonABentley 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.
Title: Re: UIPanel movement appears to be Integer based
Post by: ArenMook 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
Title: Re: UIPanel movement appears to be Integer based
Post by: JasonABentley 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!