Ejemplo n.º 1
0
 public void UnGrabControl()
 {
     isGrabbing             = false;
     heldControl            = null;
     followControlTransform = null;
     animator.SetInteger("Pose", 0);
 }
Ejemplo n.º 2
0
    public void SetGrabbedControl(GrabbableControl control)
    {
        isGrabbing             = true;
        heldControl            = control;
        followControlTransform = control.handFollowTransform;

        //Takes care of animations
        animator.SetInteger("Pose", heldControl.grabPose);
        animator.SetFloat("Pinch", 0);
        animator.SetFloat("Flex", 0);
        animator.SetLayerWeight(layerThumb, 0);
        animator.SetLayerWeight(layerPoint, 0);
    }
Ejemplo n.º 3
0
    private void Grab()
    {
        if (grabCandidates.Count == 0)
        {
            return;
        }

        isGrabbing = true;
        grabbed    = grabCandidates[0];
        hand.SetGrabbedControl(grabbed);
        grabbed.Grab(this);
        grabCandidates.Clear();
        grabbed.RemoveHandHover(gameObject);

        foreach (Collider collider in grabColliders)
        {
            collider.enabled = false;
        }
    }
Ejemplo n.º 4
0
    private void OnTriggerExit(Collider other)
    {
        //Checks other for a physicalControl layer
        if (other.gameObject.layer != LayerMask.NameToLayer("PhysicalControl"))
        {
            return;
        }

        //Checks for a GrabbableControl on the other.
        GrabbableControl control = other.attachedRigidbody.GetComponent <GrabbableControl>();

        if (control == null)
        {
            return;
        }

        //Removes the GrabbableControl from the list
        grabCandidates.Remove(control);
    }
Ejemplo n.º 5
0
 private void Awake()
 {
     control = GetComponent <GrabbableControl>();
 }