Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Isamson on April 30, 2014, 02:52:32 PM

Title: Moving object with Center on child
Post by: Isamson on April 30, 2014, 02:52:32 PM
Hi,
I'm attempting to move the parent of a uitable while it's performing a Center on child. For some reason the tween within the Center on child stops if the objects parent is moved or tweened.

Is this a normal behavior? Is there a workaround for this?

Edit 1: Here is what I noticed:
The Spring Panel's Target XYZ usually matches the x,y,z position of the UIPanel. But if I move the parent of the panel doing the Center on child, the UIPanels X position (the one being tween by the Center on child) changes to a different value. It basically un-syncs with the Spring Panel if it's moved and the Center on child simply stop centering the panel.
Title: Re: Moving object with Center on child
Post by: ArenMook on April 30, 2014, 05:55:10 PM
UICenterOnChild goes to a specific position. If you move the children after it's initiated, it will effectively be moving to the "old" position.
Title: Re: Moving object with Center on child
Post by: Isamson on May 01, 2014, 07:47:20 AM
Is there anyway around this? I was under the impression that the Center on child was using the Local Position, so I thought it wouldn't be influenced by a tween on the parent.
Title: Re: Moving object with Center on child
Post by: ArenMook on May 02, 2014, 07:51:30 AM
UICenterOnChild just uses SpringPanel, which uses local space coordinates. It adjusts the panel's position by one value and the clip offset by the opposite, thus resulting in the content moving into place. Can you draw the hierarchy of where everything is?
Title: Re: Moving object with Center on child
Post by: Isamson on May 02, 2014, 07:59:22 AM
Sure thing,

UIRoot
    - camera
        -Panel (main)
            -anchor
                - offset (empty GO)
                    - tween (this is the object moving)
                        - offset for Panel
                             - Panel (clipped) containing the Spring Panel

So I'm tweening the tween at the same time I'm calling the center on child.         
     
Title: Re: Moving object with Center on child
Post by: ArenMook on May 02, 2014, 09:33:02 AM
Aside from it being overly complicated, and the fact that there shouldn't be the "anchor" there, I see nothing wrong with the hierarchy, so I honestly am not sure what to suggest.
Title: Re: Moving object with Center on child
Post by: Isamson on May 02, 2014, 09:36:14 AM
I'll find a work around. Probably do the tween first and after that apply the spring panel.