Exemplo n.º 1
0
        private void OnTwoHandManipulationUpdated()
        {
#if UNITY_2017_2_OR_NEWER
            var targetRotation = hostTransform.rotation;
            var targetPosition = hostTransform.position;
            var targetScale    = hostTransform.localScale;

            if ((currentState & ManipulationMode.Move) > 0)
            {
                targetPosition = moveLogic.Update(GetHandsCentroid(), targetPosition);
            }

            if ((currentState & ManipulationMode.Rotate) > 0)
            {
                targetRotation = rotateLogic.Update(handsPressedLocationsMap, hostTransform, targetRotation);
            }

            if ((currentState & ManipulationMode.Scale) > 0)
            {
                targetScale = scaleLogic.UpdateMap(handsPressedLocationsMap);
            }

            UpdateHostTransform(targetPosition, targetRotation, targetScale);
#endif // UNITY_2017_2_OR_NEWER
        }
        private void OnTwoHandManipulationUpdated()
        {
#if UNITY_2017_2_OR_NEWER
            var targetRotation = HostTransform.rotation;
            var targetPosition = HostTransform.position;
            var targetScale    = HostTransform.localScale;

            if ((currentState & State.Moving) > 0)
            {
                targetPosition = m_moveLogic.Update(GetHandsCentroid(), targetPosition);
            }
            if ((currentState & State.Rotating) > 0)
            {
                targetRotation = m_rotateLogic.Update(m_handsPressedLocationsMap, HostTransform, targetRotation);
            }
            if ((currentState & State.Scaling) > 0)
            {
                targetScale = m_scaleLogic.UpdateMap(m_handsPressedLocationsMap);
            }

            HostTransform.position   = targetPosition;
            HostTransform.rotation   = targetRotation;
            HostTransform.localScale = targetScale;
#endif // UNITY_2017_2_OR_NEWER
        }
Exemplo n.º 3
0
        private void OnTwoHandManipulationUpdated()
        {
#if UNITY_2017_2_OR_NEWER
            if (gameObject.name == "Movo" && StateManager.Instance.CurrentState != StateManager.State.CalibratingState)
            {
                return;
            }
            var targetRotation = hostTransform.rotation;
            var targetPosition = hostTransform.position;
            var targetScale    = hostTransform.localScale;

            if ((currentState & ManipulationMode.Move) > 0)
            {
                targetPosition = moveLogic.Update(GetHandsCentroid(), targetPosition);
            }

            if ((currentState & ManipulationMode.Rotate) > 0)
            {
                targetRotation = rotateLogic.Update(handsPressedLocationsMap, hostTransform, targetRotation);
            }

            if ((currentState & ManipulationMode.Scale) > 0)
            {
                targetScale = scaleLogic.UpdateMap(handsPressedLocationsMap);
            }

            hostTransform.position   = targetPosition;
            hostTransform.rotation   = targetRotation;
            hostTransform.localScale = targetScale;
#endif // UNITY_2017_2_OR_NEWER
        }
        private void OnTwoHandManipulationUpdated()
        {
#if UNITY_2017_2_OR_NEWER
            var targetRotation = hostTransform.rotation;
            var targetPosition = hostTransform.position;
            var targetScale    = hostTransform.localScale;

            if ((currentState & ManipulationMode.Move) > 0)
            {
                targetPosition = moveLogic.Update(GetHandsCentroid(), targetPosition);
            }

            if ((currentState & ManipulationMode.Rotate) > 0)
            {
                targetRotation = rotateLogic.Update(handsPressedLocationsMap, hostTransform, targetRotation);
            }

            if ((currentState & ManipulationMode.Scale) > 0)
            {
                targetScale = scaleLogic.UpdateMap(handsPressedLocationsMap);
            }

            hostTransform.position   = targetPosition;
            hostTransform.rotation   = targetRotation;
            hostTransform.localScale = targetScale;

            foreach (Transform child in this.transform.parent.transform)
            {
                if (child.GetComponent <LabelResetPosition>())
                {
                    child.GetComponent <LabelResetPosition>().ResetPosition(hostTransform.position, true);
                }
            }
#endif // UNITY_2017_2_OR_NEWER
        }
Exemplo n.º 5
0
        private void OnTwoHandManipulationUpdated()
        {
#if UNITY_2017_2_OR_NEWER
            var targetRotation = hostTransform.rotation;
            var targetPosition = hostTransform.position;
            var targetScale    = hostTransform.localScale;

            if ((currentState & ManipulationMode.Move) > 0)
            {
                targetPosition = moveLogic.Update(GetHandsCentroid(), targetPosition);
            }

            if ((currentState & ManipulationMode.Rotate) > 0)
            {
                targetRotation = rotateLogic.Update(handsPressedLocationsMap, hostTransform, targetRotation);
            }

            if ((currentState & ManipulationMode.Scale) > 0)
            {
                targetScale = scaleLogic.UpdateMap(handsPressedLocationsMap);
                //manter escala da label e controlar a posicao da mesma ! sempre acima da caixa
                //tamanho do float do centro ao topo Y da caixa
                var tamanhoYtopo = hostTransform.GetChild(1).GetComponent <Collider>().bounds.size.y / 2;
                //posicao da label 0.04f ACIMA do topo da caixa
                hostTransform.GetChild(0).transform.position = hostTransform.transform.GetChild(1).transform.position + new Vector3(0, tamanhoYtopo + 0.04f, 0);
            }

            hostTransform.position = targetPosition;
            hostTransform.rotation = targetRotation;
            hostTransform.transform.GetChild(1).localScale = targetScale;
#endif // UNITY_2017_2_OR_NEWER
        }