コード例 #1
0
ファイル: CustomHandScript.cs プロジェクト: Gurwar/Gritty-Bit
    // 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();
    }