Example #1
0
    // Update is called once per frame
    void Update()
    {
        bool shoot;

        if (hand == Hands.LeftHand)
        {
            shoot = InputInfo.GetTriggerLeft();
        }
        else
        {
            shoot = InputInfo.GetTriggerRight();
        }



        if (shoot || Input.GetKey(KeyCode.Space))
        {
            Fire();
        }
        PullLever();

        transform.position = handTransform.position;
        transform.rotation = handTransform.rotation;

        if (grabber.grabbedObject != null)
        {
            currentHeldObject = grabber.grabbedObject.gameObject;
            if (currentHeldObject.GetComponent <VRObjectScript>())
            {
                MoveHeldObjectToTargetTransformInHand();
            }
        }
        else
        {
            currentHeldObject = null;
        }

        AddVelocityFrames();
        CalculateAverageVelocity();
        UpdateVelocity();
    }