Ejemplo n.º 1
0
        /// <summary>
        /// 每帧执行
        /// </summary>
        /// <param name="inputPoint">输入端世界坐标值</param>
        public void OnUpdate(Vector3 inputPoint)
        {
            if (!isEnable)
            {
                return;
            }

            currentPoint = inputPoint;

            if (lastPoint == null)
            {
                lastPoint = currentPoint;
            }

            //移动坐标
            if (HandUI != null)
            {
                HandUI.MoveHand(ScreenPoint);
            }

            //获取到射线
            Ray ray = MUtility.ScreenPointToRay(ScreenPoint);

            Ray uiRay = MUtility.UIScreenPointToRay(ScreenPoint);

            //发送射线信息
            EventHandRay.SendListener(ray, HandIndex);
            EventHandUIRay.SendListener(uiRay, HandIndex);
            EventHandRays.SendListener(ray, uiRay, HandIndex);

            //算直接坐标的插值
            lerpPoint = currentPoint - lastPoint.Value;

            //记录上一帧
            lastPoint = currentPoint;
        }