コード例 #1
0
ファイル: HandRaycastLine.cs プロジェクト: tuita520/handUI
    void Start()
    {
        line = GetComponent <LineRenderer>();
        if (transform.parent.GetComponent <HandRaycast>())
        {
            hr   = transform.parent.GetComponent <HandRaycast>();
            hand = HandUIManager.GetHand(hr.whichHand);
        }
        else
        {
            HandUIManager.Warn("HandRaycast not found", this);
        }

        DimDown();
        Hide();
    }
コード例 #2
0
    private void Awake()
    {
        uiColorMode   = _uiColorMode;
        whitePoint    = _whitePoint;
        colorGradient = _colorGradient;

        head = Hands.Provider.transform;

        var pinchGestures = FindObjectsOfType <PinchGesture>();

        if (pinchGestures.Length > 1)
        {
            foreach (var item in pinchGestures)
            {
                if (item.whichHand == Chirality.Left)
                {
                    pinchLeft = item;
                }
                else if (item.whichHand == Chirality.Right)
                {
                    pinchRight = item;
                }
                else
                {
                    Warn("Both left and right PinchGestures are required in the scene", this);
                }
            }
        }

        var interactionHands = FindObjectsOfType <InteractionHand>();

        if (interactionHands.Length > 1)
        {
            foreach (var item in interactionHands)
            {
                if (item.isLeft)
                {
                    handLeft = item;
                }
                else
                {
                    handRight = item;
                }
            }
        }
        else
        {
            Warn("Both left and right InteractionHands are required in the scene", this);
        }

        var raycasts = FindObjectsOfType <HandRaycast>();

        if (raycasts.Length > 1)
        {
            foreach (var item in raycasts)
            {
                if (item.whichHand == Chirality.Left)
                {
                    rayLeft = item;
                }
                else if (item.whichHand == Chirality.Right)
                {
                    rayRight = item;
                }
                else
                {
                    Warn("Couldn't find both left and right HandRaycasts in the scene", this);
                }
            }
        }

        prevPosR = handRight.leapHand.GetIndex().TipPosition.ToVector3();
        prevPosL = handLeft.leapHand.GetIndex().TipPosition.ToVector3();

        prevHeadRot = head.rotation;
    }