Exemplo n.º 1
0
            public void Reset()
            {
                var length = grabbedObjects.Length;

                positionOffsets = new Vector3[length];
                rotationOffsets = new Quaternion[length];
                m_InitialScales = new Vector3[length];
                for (int i = 0; i < length; i++)
                {
                    var grabbedObject = grabbedObjects[i];
                    MathUtilsExt.GetTransformOffset(rayOrigin, grabbedObject, out positionOffsets[i], out rotationOffsets[i]);
                    m_InitialScales[i] = grabbedObject.transform.localScale;
                }
            }
Exemplo n.º 2
0
            public DragState(WorkspaceUI workspaceUI, Transform rayOrigin, bool resizing)
            {
                m_WorkspaceUI  = workspaceUI;
                m_Resizing     = resizing;
                this.rayOrigin = rayOrigin;

                if (resizing)
                {
                    var pointerPosition = m_WorkspaceUI.GetPointerPosition(rayOrigin);
                    m_DragStart       = pointerPosition;
                    m_PositionStart   = workspaceUI.transform.parent.position;
                    m_BoundsSizeStart = workspaceUI.bounds.size;
                    var localPosition = m_WorkspaceUI.transform.InverseTransformPoint(pointerPosition);
                    m_Direction = m_WorkspaceUI.GetResizeDirectionForLocalPosition(localPosition);
                }
                else
                {
                    MathUtilsExt.GetTransformOffset(rayOrigin, m_WorkspaceUI.transform.parent, out m_PositionOffset, out m_RotationOffset);
                }
            }
 public void GetCurrentOffsets(Transform parent)
 {
     MathUtilsExt.GetTransformOffset(parent, transform, out m_LocalPositionOffset, out m_RotationOffset);
     m_OriginalLocalPositionOffset = m_LocalPositionOffset;
 }