示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Controller.GetPress(SteamVR_Controller.ButtonMask.Touchpad))
        {
            hasScanned = true;
            RaycastHit hit;

            // 2
            if (Physics.Raycast(trackedObj.transform.position, transform.forward, out hit, 100))
            {
                hitPoint = hit.point;
                ShowLaser(hit);
            }
        }
        else
        {
            laser.SetActive(false);
            if (hasScanned)
            {
                camscript.SetGrab();
                camscript.CallRend();
                hasScanned = false;
            }
        }
        //   if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) {
        //  if (!log) {
        //    toggle.Openlog();
        //    log = true;
        //  } else {
        //    toggle.Closelog();
        //    log = false;
        //  }
        //}
        if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
        {
            //reset cart
            cart.transform.position = ControllerGrabObject.origPos;
            cart.transform.rotation = ControllerGrabObject.originalRotationValue;
            bin1.transform.position = ControllerGrabObject.bin1pos;
            bin1.transform.rotation = ControllerGrabObject.bin1rot;
            bin2.transform.position = ControllerGrabObject.bin2pos;
            bin2.transform.rotation = ControllerGrabObject.bin2rot;
        }
    }