Exemple #1
0
    private void ActivatingStateHandler()
    {
        // Fade in the hand
        Color opaqe = new Color(0, 0, 0, 1f);
        Tween tween = HandModel.materials[1].DOColor(opaqe, "_BaseColor", 0.5f).SetOptions(true);

        // Check if base hand was grasping an object when it entered the proxy
        if (Player.Instance.GetInteractionHand(HandChirality).isGraspingObject)
        {
            // Create a duplicate at mark hand location if the base hand was grasping an object
            baseHandObject = Player.Instance.GetInteractionHand(HandChirality).graspedObject.gameObject.GetComponent <InteractionWorldObject>();
            ProxyNode proxy = LeapProvider.GetProxyNode(HandChirality);
            // Scale the grasped object to appropriate size
            Vector3 relativeScale = new Vector3(
                proxy.transform.localScale.x / Mark.transform.localScale.x,
                proxy.transform.localScale.y / Mark.transform.localScale.y,
                proxy.transform.localScale.z / Mark.transform.localScale.z
                );
            baseHandObject.ScaleAroundGraspRel(relativeScale);
            // Instatniate a duplicate at mark location
            markHandObject = baseHandObject.InstantiateDuplicate(proxy.transform, Mark.transform);
            ownership      = Ownership.BaseHand;
            ChangeState(MarkHandState.DuplicateObject);
        }
        else     // If the base hand wasn not grasping an object go to Idle state
        {
            ChangeState(MarkHandState.Idle);
        }
    }
Exemple #2
0
 private void IdleStateHandler()
 {
     if (!isEnabled)
     {
         ChangeState(MarkHandState.Deactivating);
     }
     if (interactionHand.isGraspingObject)
     {
         // Duplicate the object at base hand's location
         markHandObject = interactionHand.graspedObject.transform.GetComponent <InteractionWorldObject>();
         baseHandObject = markHandObject.InstantiateDuplicate(Mark.transform, LeapProvider.GetProxyNode(HandChirality).transform);
         ownership      = Ownership.MarkHand;
         ChangeState(MarkHandState.GraspingObject);
     }
 }