コード例 #1
0
    public void OnPositionChanged(SourcePositionEventData eventData)
    {
        // PointerPositionとGripPosition、手の位置はGrip
        var handState = GetHandState(eventData.SourceId);

        handState.Position = eventData.GripPosition;
    }
コード例 #2
0
    public void OnPositionChanged(SourcePositionEventData eventData)
    {
        Vector3 newPos = eventData.GripPosition;

        // Update hand cursor position
        gameObject.transform.GetChild(0).transform.position = newPos;
        gameObject.transform.GetChild(0).rotation           = Camera.main.transform.rotation;
        // Set z to raycast collision if hit
        //Ray cameraToPoint = new Ray(Camera.main.transform.position, newPos - Camera.main.transform.position);
        //RaycastHit hitInfo;
        //if (Physics.Raycast(cameraToPoint, out hitInfo)) //, SpatialMappingManager.LayerMask))
        //{
        //    Debug.Log("Hit: " + hitInfo.collider.gameObject.name);
        //    newPos.z = hitInfo.point.z;
        //}

        //Debug.DrawRay(eventData.GripPosition, newPos - eventData.GripPosition, color: Color.red, duration:0);
        // Debug.Log("Position Changed: " + eventData.GripPosition);
        if (Holding)
        {
            // Debug.Log("Gripping: " + eventData.GripPosition);
            if (firstPoint || !newPos.Equals(lastPoint))
            {
                CreateLinePoint(newPos);
                lastPoint = newPos;
            }
            firstPoint = false;
        }
    }
コード例 #3
0
        public void OnPositionChanged(SourcePositionEventData eventData)
        {
            m_CurrentHandPos = InputHelper.GetHandPos(currentInputSource, currentInputSourceId);

            if (m_AttachType == AttachTargetEnum.Hand && Vector3.Distance(m_HandLastPosition, m_CurrentHandPos) >= m_HandDeadzone)
            {
                m_HandLastPosition = m_CurrentHandPos;
            }
        }
コード例 #4
0
        private void InitializeEventDatas()
        {
            inputEventData           = new InputEventData(EventSystem.current);
            sourceClickedEventData   = new InputClickedEventData(EventSystem.current);
            sourceStateEventData     = new SourceStateEventData(EventSystem.current);
            manipulationEventData    = new ManipulationEventData(EventSystem.current);
            navigationEventData      = new NavigationEventData(EventSystem.current);
            holdEventData            = new HoldEventData(EventSystem.current);
            pointerSpecificEventData = new PointerSpecificEventData(EventSystem.current);
            inputPositionEventData   = new InputPositionEventData(EventSystem.current);
            selectPressedEventData   = new SelectPressedEventData(EventSystem.current);
            sourceRotationEventData  = new SourceRotationEventData(EventSystem.current);
            sourcePositionEventData  = new SourcePositionEventData(EventSystem.current);
            xboxControllerEventData  = new XboxControllerEventData(EventSystem.current);
#if UNITY_WSA || UNITY_STANDALONE_WIN
            speechEventData    = new SpeechEventData(EventSystem.current);
            dictationEventData = new DictationEventData(EventSystem.current);
#endif
        }
コード例 #5
0
 public void OnPositionChanged(SourcePositionEventData eventData)
 {
     //Debug.Log("Position Change");
     gameObject.transform.position = eventData.GripPosition;
 }
コード例 #6
0
 public void OnPositionChanged(SourcePositionEventData eventData)
 {
 }
コード例 #7
0
 public void OnPositionChanged(SourcePositionEventData eventData)
 {
     gameObject.transform.position = eventData.GripPosition;
     gameObject.transform.LookAt(CameraCache.Main.transform.position);
 }