Exemplo n.º 1
0
        private void TriggerDown(stExternalInteractData _externalInteractData)
        {
            Debug.Log("Trigger Down : " + name + " " + _externalInteractData.HandType);

            if (isRequestedGrabMessage)
            {
                return;
            }
            isRequestedGrabMessage = true;
            Transform  grabTm = VRHandEventHandler.GetHandGrabPivot(_externalInteractData.HandType);
            Vector3    pos    = grabTm.InverseTransformPoint(Pivot.position);
            Quaternion rot    = Quaternion.Inverse(grabTm.rotation) * Pivot.rotation;

            if (m_GrabData.AmIGrabbing && m_GrabData.HandType != _externalInteractData.HandType)
            {
                VRHandEventHandler.UnGrabInteractObject(m_GrabData.HandType, this);
            }

            if (m_bIsOnlyLocalObject)
            {
                m_GrabData.SetGrabData(MyNetworkManager.MyNetID, _externalInteractData.HandType, pos, rot, Time.time);
                GrabSomething();
            }
            else
            {
                //Debug.Log("Send Grab : " + name + " " + _externalInteractData.HandType);
                MyNetworkManager.SendToServer_Grab(UID, _externalInteractData.HandType, pos, rot);
            }
        }
Exemplo n.º 2
0
        private void TriggerUp(stExternalInteractData _externalInteractData)
        {
            //Debug.Log("Trigger Up : " + name + " " + _externalInteractData.HandType);
            if (isRequestedGrabMessage)
            {
                return;
            }

            bool isGrab = VRHandEventHandler.IsGrab(_externalInteractData.HandType, this);

            if (isGrab)
            {
                isRequestedGrabMessage = true;
                Vector3    pos      = Pivot.position;
                Quaternion rot      = Pivot.rotation;
                Vector3    velocity = VRInputManager.GetVelocity(_externalInteractData.HandType, VRInputManager.PositionType.CONTROLLER);

                if (m_bIsOnlyLocalObject)
                {
                    m_GrabData.SetUnGrabData(_externalInteractData.HandType, pos, rot, velocity, Time.time);
                    UnGrabSomething();
                }
                else
                {
                    //Debug.Log("Send UnGrab : " + name + " " + _externalInteractData.HandType);
                    MyNetworkManager.SendToServer_UnGrab(UID, _externalInteractData.HandType, pos, rot, velocity);
                }
            }
        }
        public virtual void ListenExternalMessage(stExternalInteractData _externalInteractData)
        {
            switch (_externalInteractData.InteractMessage)
            {
            case eExternalInteractMessage.EnterHand: EnterHand(_externalInteractData.HandType); break;

            case eExternalInteractMessage.ExitHand: ExitHand(_externalInteractData.HandType); break;
            }
        }
        public override void ListenExternalMessage(stExternalInteractData _externalInteractData)
        {
            base.ListenExternalMessage(_externalInteractData);
            switch (_externalInteractData.InteractMessage)
            {
            case eExternalInteractMessage.EnterHMD: OnRayEnter(); break;

            case eExternalInteractMessage.StayHMD: OnRayStay(); break;

            case eExternalInteractMessage.ExitHmd: OnRayExit(); break;
            }
        }
Exemplo n.º 5
0
        public override void ListenExternalMessage(stExternalInteractData _externalInteractData)
        {
            base.ListenExternalMessage(_externalInteractData);
            switch (_externalInteractData.InteractMessage)
            {
            case eExternalInteractMessage.TriggerDown:
                TriggerDown(_externalInteractData);
                break;

            case eExternalInteractMessage.TriggerUp:
                TriggerUp(_externalInteractData);
                break;
            }
        }