Author Topic: problem with draggable panels  (Read 1657 times)

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
problem with draggable panels
« 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. }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: problem with draggable panels
« Reply #1 on: October 03, 2013, 04:20:29 AM »
"an error has occurred. Please try again later"