Beispiel #1
0
    // Petting Methods
    //================================================

    // Interaction considered petting if:
    // - hand is moving side to side
    // - and hand is open
    private void determineIfHandPetting(GameObject col)
    {
        Hand colHand = detectLeapCollision.getHandFromCollision(col);

        if (colHand == null)
        {
            return;
        }

        bool handOpen;

        if (colHand.IsLeft)
        {
            handOpen = handObserverLeft.isOpen();
        }
        else if (colHand.IsRight)
        {
            handOpen = handObserverRight.isOpen();
        }
        else
        {
            return;
        }

        if (isMovingAlongLocalAxisX(detectLeapCollision.getPalmFromCollision(col), colHand.PalmVelocity.ToVector3()) && handOpen)
        {
            petProcessor.notifyReceivingPetMotion(colHand);
        }
    }
Beispiel #2
0
    // Lift occurs if:
    // - hand is moving "up" (visually)
    // - palm of hand is facing up
    private void OnCollisionEnter(Collision col)
    {
        if (detectLeapCollision.isHandCollision(col.gameObject))
        {
            Hand colHand = detectLeapCollision.getHandFromCollision(col.gameObject);
            if (colHand == null)
            {
                return;
            }

            if (!isMovingDownLocalAxisY(detectLeapCollision.getPalmFromCollision(col.gameObject), colHand.PalmVelocity.ToVector3()))
            {
                return;
            }

            if (colHand.IsLeft && handObserverLeft.isOpenFaceUp())
            {
                attachToObject(attachLeftHandObj);
                updateLiftVariables(handObserverLeft, colHand, true);
            }
            else if (colHand.IsRight && handObserverRight.isOpenFaceUp())
            {
                attachToObject(attachRightHandObj);
                updateLiftVariables(handObserverRight, colHand, true);
            }
        }
    }