protected override float CastRayForward()
        {
            Transform  origin         = GetOrigin();
            Ray        pointerRaycast = new Ray(origin.position, origin.forward);
            RaycastHit pointerCollidedWith;
            bool       rayHit = VRTK_CustomRaycast.Raycast(customRaycast, pointerRaycast, out pointerCollidedWith, defaultIgnoreLayer, maximumLength);

            CheckRayMiss(rayHit, pointerCollidedWith);
            CheckRayHit(rayHit, pointerCollidedWith);

            float actualLength = maximumLength;

            if (rayHit && pointerCollidedWith.distance < maximumLength)
            {
                actualLength = pointerCollidedWith.distance;
            }

            //当たってる対象がAnimationWindowならマウス操作
            if (rayHit && pointerCollidedWith.collider.tag == "AnimationWindow")
            {
                var mousePosInEditorWindow = animationWindowController.GetMousePosInEditorWindowFromUV(pointerCollidedWith.textureCoord);
                if (mousePosInEditorWindow != null && editorWindowCapture != null)
                {
                    //pointer.position = desktopPos.Value;
                    pointerPos = mousePosInEditorWindow.Value;

                    if (state == TouchState.Release)
                    {
                        //GetPointer();
                        //pointer.Hover();
                        state = TouchState.Hover;
                        editorWindowCapture.SendEvent(pointerPos, EventType.MouseMove);
                    }
                    else
                    {
                        editorWindowCapture.SendEvent(pointerPos, EventType.MouseDrag);
                    }
                }

                GetComponent <VRTK.VRTK_Pointer>().Toggle(true);
            }
            //UIに当たってればUI操作
            else if (uiPointer.pointerEventData.pointerEnter)
            {
                GetComponent <VRTK.VRTK_Pointer>().Toggle(true);
            }
            //AnimationWindowにもUIにも当たっていない
            else
            {
                state = TouchState.Release;
                GetComponent <VRTK.VRTK_Pointer>().Toggle(false);
                GetComponent <VRTK.VRTK_Pointer>().pointerRenderer.Toggle(false, false);
            }

            return(OverrideBeamLength(actualLength));
        }
Ejemplo n.º 2
0
 void OnHovering(BaseHandle handle, HandleEventData eventData)
 {
     m_Capture.SendEvent(eventData.rayOrigin, transform, EventType.MouseMove);
 }