Beispiel #1
0
    private void CheckForEndOfManipulation()
    {
        if (grabSphereAnchoring.IsAnchoring)
        {
            return;
        }
        modeChangeTimer += Time.deltaTime;
        if (modeChangeTimer < ManipulationDeactivationTimeout)
        {
            return;
        }

        state = MarkManipulationState.Inactive;
        grabSphereAnchoring.AllowAnchoring = false;
        leftHand.StopManipulationMode();
        rightHand.StopManipulationMode();
        grabSphere.SetActive(false);
        mark.Flash(1);

        foreach (var obj in deactivatedObjects)
        {
            obj.ignoreGrasping = false;
        }
        deactivatedObjects.Clear();
    }
Beispiel #2
0
    private void ActivateManipulation()
    {
        state = MarkManipulationState.Active;
        mark.Flash(2);

        var handPos = GetMeanHandPosition();
        var handVec = (transform.position - handPos).normalized;

        handPos = handPos + 0.3f * mark.Radius * handVec;

        leftHand.StartManipulationMode();
        rightHand.StartManipulationMode();

        grabSphere.SetActive(true);
        grabSphere.transform.position = handPos;
        grabSphere.transform.DOScale(0f, 0.05f).From().SetEase(Ease.InQuad);
        grabSphereAnchoring.AllowAnchoring = true;

        foreach (var obj in grabSphereLeap.manager.interactionObjects)
        {
            if (obj.gameObject == grabSphere)
            {
                continue;
            }
            if (obj.ignoreGrasping == true)
            {
                continue;
            }

            var behavior = obj.gameObject.GetComponent <InteractionBehaviour>();
            behavior.ignoreGrasping = true;
            deactivatedObjects.Add(behavior);
        }
    }
Beispiel #3
0
 private void CheckForActivation()
 {
     if (IsIdleAndOnShell(leftHand) || IsIdleAndOnShell(rightHand))
     {
         modeChangeTimer = Time.deltaTime;
         state           = MarkManipulationState.Activating;
         mark.Flash(1);
     }
 }
Beispiel #4
0
 private void CheckForContinuedActivation()
 {
     if (IsIdleAndOnShell(leftHand) || IsIdleAndOnShell(rightHand))
     {
         modeChangeTimer += Time.deltaTime;
         if (modeChangeTimer > ManipulationActivationTimeout)
         {
             ActivateManipulation();
         }
     }
     else
     {
         state = MarkManipulationState.Inactive;
     }
 }