Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: laurentl on October 02, 2013, 06:15:27 PM

Title: problem with draggable panels
Post by: laurentl on October 02, 2013, 06:15:27 PM
it's all offset for some reason:
structure is:
panel with draggable panel
grid
dragpanelcontents ...

it looks like this : https://www.youtube.com/watch?v=JVbhdG0CBv4

I'm using this script to center on click:


  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CenterOnObject : MonoBehaviour {
  5.  
  6.         public UIDraggablePanel dragPanel;
  7.         void Start ()
  8.         {
  9.                 dragPanel = NGUITools.FindInParents<UIDraggablePanel> (gameObject);
  10.         }
  11.  
  12.         void OnClick ()
  13.         {
  14.                 Center ();
  15.         }
  16.         public void Center ()
  17.         {
  18.                 if (dragPanel) {
  19.                         Vector3 pos = dragPanel.transform.worldToLocalMatrix.MultiplyPoint3x4 (transform.position);
  20.                         SpringPanel.Begin (dragPanel.gameObject, -pos, 7f);
  21.                 }
  22.         }
  23. }
Title: Re: problem with draggable panels
Post by: ArenMook on October 03, 2013, 04:20:29 AM
"an error has occurred. Please try again later"