コード例 #1
0
        public override void ManipulationUpdate(Vector3 startGesturePosition, Vector3 currentGesturePosition, Vector3 startHeadOrigin, Vector3 startHeadRay, GestureInteractive.GestureManipulationState gestureState)
        {
            base.ManipulationUpdate(startGesturePosition, currentGesturePosition, startHeadOrigin, startHeadRay, gestureState);

            // get gesture data for gesturing along the horizontal axis
            GestureInteractiveData gestureData = GetGestureData(new Vector3(1, 0, 0), MaxGestureDistance, FlipDirectionOnCameraForward);

            for (int i = 0; i < mCycleList.Count; ++i)
            {
                CycleData data = mCycleList[i];
                // get the length of ICycle values to loop through
                float length    = data.Controller.GetLastIndex() + 1;
                float incrament = MaxGestureDistance / length;

                // get the delta of the current gesture
                int offset = Mathf.RoundToInt(gestureData.Distance / incrament);
                if (gestureState == GestureInteractive.GestureManipulationState.Start)
                {
                    // set the starting index so we can add the delta to it
                    data.Index = data.Controller.Index;

                    mCycleList[i] = data;
                }

                // update the ICycle component
                data.Controller.SetIndex(Mathf.Clamp(offset + data.Index, 0, data.Controller.GetLastIndex()));
            }
        }
コード例 #2
0
ファイル: RadialSlider.cs プロジェクト: gdoc-tech/Holocopter
    public override void ManipulationUpdate(Vector3 startGesturePosition, Vector3 currentGesturePosition,
                                            Vector3 startHeadOrigin, Vector3 startHeadRay, GestureInteractive.GestureManipulationState gestureState)
    {
        GestureInteractiveData gestureData =
            GetGestureData(new Vector3(1, 0, 0), MaxGestureDistance, FlipDirectionOnCameraForward);

        vertData.Direction = gestureData.Direction;
        //HandPosition2D.x = vertData.Direction.x * 300/(1+CurrentPercentage*CurrentPercentage*CurrentPercentage*12);
        //HandPosition2D.y = vertData.Direction.y * 300/(1+CurrentPercentage*CurrentPercentage*CurrentPercentage*10);

        // Debug.Log("CurrentPercentage=" + CurrentPercentage);
        // Debug.Log("CurrentPercentage=" + CurrentPercentage);
        HandPosition2D.x = DirectionVector.x * 200;
        HandPosition2D.y = DirectionVector.y * 200;
        base.ManipulationUpdate(startGesturePosition, currentGesturePosition, startHeadOrigin, startHeadRay,
                                gestureState);
    }