Exemplo n.º 1
0
        // Update is called once per frame
        void Update()
        {
            claws.setScale(Mathf.Lerp(claws.getScale(), showingClaws ? 1 : 0, 0.15f));

            if (poses != null)
            {
                if (poses.currentPose != null && poses.currentPose.name == "fist")
                {
                    if (clawToggle.GetAxis(hand) >= 0.6f && !toggleClawTriggered)
                    {
                        toggleClaws();
                        toggleClawTriggered = true;
                    }
                    else
                    {
                        if (clawToggle.GetAxis(hand) < 0.6f)
                        {
                            toggleClawTriggered = false;
                        }
                    }
                }
                else
                {
                    hideClaws();
                }
            }
        }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (m_GrabAction.GetStateDown(m_Pose.inputSource))
        {
            if (m_CurrentInteractable == null)
            {
                Pickup(); //BUG: Can take the last object out of gallery multiple times
            }
            else
            {
                Drop();
            }
        }

        if (m_SecondaryAction.GetStateUp(m_Pose.inputSource))
        {
            DoSecondary();
        }

        if (m_PushAction.GetAxis(m_Pose.inputSource) != 0f)
        {
            DoPrimary();
        }
        else if (m_Cancontroller != null)
        {
            m_Cancontroller.onSprayStop();
        }
    }
 /// <summary>
 /// Performs smoothing based on deltaTime parameter.
 /// </summary>
 public void Update(float deltaTime, SteamVR_Input_Sources inputSource)
 {
     if (type == BlenderTypes.AnalogAction)
     {
         if (smoothingSpeed == 0)
         {
             value = action_single.GetAxis(inputSource);
         }
         else
         {
             value = Mathf.Lerp(value, action_single.GetAxis(inputSource), deltaTime * smoothingSpeed);
         }
     }
     if (type == BlenderTypes.BooleanAction)
     {
         if (smoothingSpeed == 0)
         {
             value = action_bool.GetState(inputSource) ? 1 : 0;
         }
         else
         {
             value = Mathf.Lerp(value, action_bool.GetState(inputSource) ? 1 : 0, deltaTime * smoothingSpeed);
         }
     }
 }
Exemplo n.º 4
0
    void FixedUpdate()
    {
        // tests if hand is still grabbed onto the wall
        if (isGrappedLeft || isGrappedRight)
        {
            isGrapped = true;
        }
        else
        {
            isGrapped = false;
        }

        if (!isGrapped)
        {
            body.useGravity = true;
        }

        // LeftHand
        if (leftHand.canGrip && GetGrap(leftHand.hand))
        {
            body.velocity            = Vector3.zero;
            body.useGravity          = false;
            body.transform.position += (leftHand.previousPosition - leftHand.hand.transform.localPosition);
            isGrappedLeft            = true;
        }
        else if (leftHand.canGrip && GetGrapUp(leftHand.hand, lastLeftGrap))
        {
            body.useGravity = true;
            body.velocity   = (leftHand.previousPosition - leftHand.hand.transform.localPosition) / Time.deltaTime;
        }
        else
        {
            isGrappedLeft = false;
        }

        // RightHand
        if (rightHand.canGrip && GetGrap(rightHand.hand))
        {
            body.velocity            = Vector3.zero;
            body.useGravity          = false;
            body.transform.position += (rightHand.previousPosition - rightHand.hand.transform.localPosition);
            isGrappedRight           = true;
        }
        else if (rightHand.canGrip && GetGrapUp(rightHand.hand, lastRightGrap))
        {
            body.useGravity = true;
            body.velocity   = (rightHand.previousPosition - rightHand.hand.transform.localPosition) / Time.deltaTime;
        }
        else
        {
            isGrappedRight = false;
        }

        lastLeftGrap  = grapAction.GetAxis(leftHand.hand.handType);
        lastRightGrap = grapAction.GetAxis(rightHand.hand.handType);

        leftHand.previousPosition  = leftHand.hand.transform.localPosition;
        rightHand.previousPosition = rightHand.hand.transform.localPosition;
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Debug.Log(thrustAction.GetAxis(leftHand));
        Debug.Log(thrustAction.GetAxis(rightHand));

        float leftThrust  = thrustAction.GetAxis(leftHand);
        float rightThrust = thrustAction.GetAxis(rightHand);

        rb.AddForce(leftHandTransform.forward * leftThrust * power * Time.deltaTime);
        rb.AddForce(rightHandTransform.forward * rightThrust * power * Time.deltaTime);
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (m_GrabAction.GetAxis(m_Pose.inputSource) > 0)
        {
            Pickup();
        }

        if (m_GrabAction.GetAxis(m_Pose.inputSource) == 0)
        {
            Drop();
        }
    }
Exemplo n.º 7
0
    private void UpdateGame()
    {
        //Deal with gesture starting and stopping and hand grabbing
        if (grabAction.GetAxis(SteamVR_Input_Sources.LeftHand) >= 0.1f)
        {
            if (!leftHand.GetGrabbing())
            {
                leftHand.ToggleGrabbing();
                gestureManager.BeginGesture(this, true, true);
            }
        }
        else
        {
            if (leftHand.GetGrabbing())
            {
                leftHand.ToggleGrabbing();
                spellHandler.CastSpell(gestureManager.EndGesture(), gestureManager.CurrentHand());
            }
        }

        if (grabAction.GetAxis(SteamVR_Input_Sources.RightHand) >= 0.1f)
        {
            if (!rightHand.GetGrabbing())
            {
                rightHand.ToggleGrabbing();
                gestureManager.BeginGesture(this, false, true);
            }
        }
        else
        {
            if (rightHand.GetGrabbing())
            {
                rightHand.ToggleGrabbing();
                spellHandler.CastSpell(gestureManager.EndGesture(), gestureManager.CurrentHand());
            }
        }

        gestureManager.Update(this, Time.deltaTime, true);

        //Deal with player movement
        CalcMovement();

        //Remove the shield material if the shield is gone
        if (healthComp.ShieldBroke())
        {
            leftHand.GetComponentInChildren <SkinnedMeshRenderer>().material  = baseMaterial;
            rightHand.GetComponentInChildren <SkinnedMeshRenderer>().material = baseMaterial;
        }

        leftHand.SetGems(healthComp.GetHealth() / (float)startingHP);
        rightHand.SetGems(healthComp.GetHealth() / (float)startingHP);
    }
Exemplo n.º 8
0
    void Update()
    {
        // Move X and Z
        Vector2 dlVR       = speed * Time.deltaTime * moveAction.GetAxis(handType);
        Vector2 dlKeyboard = speed * Time.deltaTime * new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        Vector2 dl         = dlVR + dlKeyboard;
        Vector3 move       = cameraTransform.right * dl.x + cameraTransform.forward * dl.y;

        move.y = 0;
        controller.Move(move);
        if (move.magnitude > 0.001f)
        {
            GetComponent <AudioSource>().enabled = true;
        }
        if (move.magnitude < 0.001f)
        {
            GetComponent <AudioSource>().enabled = false;
        }
        // Jump
        bool  isGrounded    = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
        float jumpIntensity = 0f;

        if (isGrounded)
        {
            yVelocity     = -2f;
            jumpIntensity = Mathf.Pow(jumpAction.GetAxis(handType), 0.02f) + Input.GetAxis("Jump");
        }
        yVelocity += gravity * Time.deltaTime + jumpIntensity * jumpStrength;
        controller.Move(Vector3.up * (yVelocity * Time.deltaTime));
    }
Exemplo n.º 9
0
    void ListenForPickupButtonPress()
    {
        if (pickUpButton.GetStateDown(pose.inputSource))
        {
            atExtendedDistance = true;
            Debug.Log("Pressed: " + pickUpButton.fullPath + " on " + pose.inputSource);
            PickUpObject();
        }

        if (pickUpButton.GetStateUp(pose.inputSource))
        {
            atExtendedDistance = false;
            Debug.Log("Released: " + pickUpButton.fullPath + " on " + pose.inputSource);
            DropObject();
        }

        if (single.GetAxis(pose.inputSource) == 1)
        {
            atExtendedDistance = true;
        }
        else
        {
            atExtendedDistance = false;
        }

        // Debug.LogError("Axis value is : " + single.axis);
    }
        void OnChange(SteamVR_Action_In action) //Creates and deploys an Event on any Input action
        {
            STKEventSender sender = GetComponent <STKEventSender>();

            sender.SetEventValue("Name", action.GetShortName());
            if (action.GetType() == typeof(SteamVR_Action_Boolean))
            {
                SteamVR_Action_Boolean v = (SteamVR_Action_Boolean)action;
                sender.SetEventValue("boolValue", v.GetState(SteamVR_Input_Sources.Any));
            }
            else if (action.GetType() == typeof(SteamVR_Action_Single))
            {
                SteamVR_Action_Single v = (SteamVR_Action_Single)action;
                sender.SetEventValue("singleValue", v.GetAxis(SteamVR_Input_Sources.Any));
            }
            else if (action.GetType() == typeof(SteamVR_Action_Vector2))
            {
                SteamVR_Action_Vector2 v = (SteamVR_Action_Vector2)action;
                sender.SetEventValue("vector2Value", v.GetAxis(SteamVR_Input_Sources.Any));
            }
            else if (action.GetType() == typeof(SteamVR_Action_Vector3))
            {
                SteamVR_Action_Vector3 v = (SteamVR_Action_Vector3)action;
                sender.SetEventValue("vector3Value", v.GetAxis(SteamVR_Input_Sources.Any));
            }
            sender.Deploy();
        }
    //First way
    void Update( )
    {
        if (SteamVR_Actions._default.Teleport.GetStateUp(SteamVR_Input_Sources.Any))
        {
            //Debug.Log ( "TELEPORT STATE UP" );
        }

        if (SteamVR_Actions._default.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any))
        {
            //Debug.Log ( "GRABPINCH STATE UP" );
        }

        float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);

        if (triggerValue >= 0)
        {
            //Debug.Log ( triggerValue );
        }

        Vector2 touchPadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any);

        if (touchPadValue != Vector2.zero)
        {
            //Debug.Log ( touchPadValue );
        }
    }
Exemplo n.º 12
0
    void Update()
    {
        if (teleportAction.GetStateDown(SteamVR_Input_Sources.Any))
        {
            print("Teleport down.");
        }
        if (grabAction.GetStateUp(SteamVR_Input_Sources.Any))
        {
            print("Grab Pinch up.");
        }

        float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);

        if (triggerValue > 0.0f)
        {
            print(triggerValue);
        }

        Vector2 touchPadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any);

        if (touchPadValue != Vector2.zero)
        {
            print(touchPadValue);
        }
    }
Exemplo n.º 13
0
    public void CustomUpdate(CustomHand hand)
    {
        if (weaponController.GetMyGrabPoser(hand) == weaponController.grabPoints[0]) // check if hand holding a handle with trigger
        {
            triggerAxis = triggerState.GetAxis(hand.handType);

            if (triggerClick.GetStateDown(hand.handType) && state == 0)
            {
                state = 1;
                //weaponController.Shoot();
            }
            else if (triggerClick.GetStateUp(hand.handType))
            {
                state = 2;
            }
            else if (state == 2 && triggerAxis < 0.5f)
            {
                state = 0;
            }

            TriggerTransformMovement(triggerAxis);
        }
        else
        {
            return;
        }
    }
Exemplo n.º 14
0
        public bool IsSqueezing()
        {
            bool requiredFingers = true;

            if (squeezeFingersRequired.Length == 0)
            {
                requiredFingers = false;
            }
            else
            {
                for (int i = 0; i < squeezeFingersRequired.Length; i++)
                {
                    if (GetFingerCurl(squeezeFingersRequired[i].finger) < squeezeFingersRequired[i].amount)
                    {
                        requiredFingers = false;
                    }
                }
            }

            if (squeezeAction != null && squeezeAction.GetAxis(handType) > requiredSqueeze)
            {
                requiredFingers = true;
            }

            return(requiredFingers);
        }
Exemplo n.º 15
0
        private void Update()
        {
            float grip  = 0;
            float pinch = 0;

            if (interactable.attachedToHand)
            {
                grip  = gripSqueeze.GetAxis(interactable.attachedToHand.handType);
                pinch = pinchSqueeze.GetAxis(interactable.attachedToHand.handType);
            }

            renderer.SetBlendShapeWeight(0, Mathf.Lerp(renderer.GetBlendShapeWeight(0), grip * 150, Time.deltaTime * 10));

            if (renderer.sharedMesh.blendShapeCount > 1) // make sure there's a pinch blend shape
            {
                renderer.SetBlendShapeWeight(1, Mathf.Lerp(renderer.GetBlendShapeWeight(1), pinch * 200, Time.deltaTime * 10));
            }

            if (affectMaterial)
            {
                renderer.material.SetFloat("_Deform", Mathf.Pow(grip * 1.5f, 0.5f));
                if (renderer.material.HasProperty("_PinchDeform"))
                {
                    renderer.material.SetFloat("_PinchDeform", Mathf.Pow(pinch * 2.0f, 0.5f));
                }
            }
        }
Exemplo n.º 16
0
    private void MoveMapCamera()
    {
        Vector3    orientationEuler = new Vector3(0, transform.eulerAngles.y, 0);
        Quaternion orientation      = Quaternion.Euler(orientationEuler);
        Vector3    movement         = Vector3.zero;
        float      m_Speed          = 0;

        Vector2 padPos       = m_MoveValue.GetAxis(SteamVR_Input_Sources.LeftHand);
        float   triggerValue = m_MovePress.GetAxis(SteamVR_Input_Sources.LeftHand);

        // If not pressing button
        if (triggerValue == 0.0f)
        {
            m_Speed = 0;
        }

        // If pressing touchpad
        if (triggerValue >= 0.0f)
        {
            m_Speed = 2.5f;
            MapCamera.transform.Translate(Vector3.up * m_Speed * padPos.y, Space.Self);
            MapCamera.transform.Translate(Vector3.right * m_Speed * padPos.x, Space.Self);
            FixedMapCamera.transform.position += m_Speed * new Vector3(padPos.x, 0, padPos.y);
        }

        // 調整mapCamera角度與頭朝向一致
        float   fpsRot = FPSCamera.transform.eulerAngles.y;
        Vector3 mapRot = MapCamera.transform.eulerAngles;

        MapCamera.transform.rotation = Quaternion.Euler(mapRot.x, fpsRot, 0);
    }
Exemplo n.º 17
0
    public void VRCameraTransition() //VRCamera 오브젝트의 위치를 변경하는 함수
    {
        float _triggerAxis = _triggerVector1.GetAxis(SteamVR_Input_Sources.RightHand);

        if (_triggerAxis > 0.6f)
        {
            float _rotateSpeed     = 100f;
            float _rotateDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).x;
            _VRCameraTransform.LookAt(_centerAxis);                                                 //중심 축을 바라봄
            _VRCameraTransform.Translate(_rotateDirection * Time.deltaTime * _rotateSpeed, 0f, 0f); //카메라 이동
        }
        else
        {
            _centerAxis = _VRCameraTransform.position + _VRCameraTransform.forward * 50f; //중심 축 지정

            float _moveSpeed     = 100f;
            float _moveDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).y;
            if (Mathf.Abs(_moveDirection) > 0.3f)
            {
                _VRCameraTransform.position += _target.GetComponent <Transform>().forward *Time.deltaTime *_moveSpeed *_moveDirection;
            }

            float _rotateSpeed     = 100f;
            float _rotateDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).x;
            if (Mathf.Abs(_rotateDirection) > 0.3f)
            {
                _VRCameraTransform.Rotate(0f, _rotateSpeed * _rotateDirection * Time.deltaTime, 0f);
            }
        }
    }
        public void Update()
        {
            if (squeezeAction != null && squeezeAction.GetState(handType) && !squeezing)
            {
                squeezing = true;
                hand.Squeeze();
            }
            else if (squeezeAction != null && !squeezeAction.GetState(handType) && squeezing)
            {
                squeezing = false;
                hand.Unsqueeze();
            }

            if (grabAction != null && grabAction.GetState(handType) && !grabbing)
            {
                grabbing = true;
                hand.Grab();
            }
            else if (grabAction != null && !grabAction.GetState(handType) && grabbing)
            {
                grabbing = false;
                hand.Release();
            }

            if (grabAxis != null)
            {
                hand.SetGrip(grabAxis.GetAxis(handType));
            }
        }
Exemplo n.º 19
0
    /// <summary>
    /// Called once a frame.
    /// Used for getting input and what to do with it.
    /// </summary>
    void Update()
    {
        if (SteamVR_Input._default.inActions.Teleport.GetStateDown(SteamVR_Input_Sources.Any))
        {
            player.Teleport();
        }



        float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);

        if (triggerValue > 0.01f)
        {
        }

        Vector2 touchpadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any);

        if (touchpadValue != Vector2.zero)
        {
        }
        if (equipped)
        {
            if (SteamVR_Input._default.inActions.Draw.GetLastStateUp(SteamVR_Input_Sources.RightHand) && drawing)
            {
                Check();
                if (drawingParticles)
                {
                    drawingParticles.SetActive(false);
                }
                drawing = false;
            }
        }
    }
Exemplo n.º 20
0
    // Update is called once per frame
    void Update()
    {
        if (shoot.GetAxis(hand) < 0.2)
        {
            canShoot = true;
        }

        if (shoot.GetAxis(hand) >= 0.2 && canShoot)
        {
            SpawnBullet();
            animator.SetTrigger("Shoot");
            AudioSource.PlayClipAtPoint(shootSound, muzzle.position);
            haptic.Execute(0f, .1f, 100f, 1f, hand);
            canShoot = false;
        }
    }
Exemplo n.º 21
0
    // Update is called once per frame
    void Update()
    {
        squeeze = 0;
        if (interactable.attachedToHand)
        {
            SteamVR_Input_Sources hand = interactable.attachedToHand.handType;

            squeeze = actionSqueeze.GetAxis(hand);
        }

        if (squeeze >= 0.002)
        {
            gameManager.drillActive = true;
        }
        else
        {
            gameManager.drillActive = false;
        }
        modelTrigger.localRotation = trigSRot;
        modelTrigger.Rotate(squeeze * triggerRot, 0, 0, Space.Self);
        gameManager.drillRotation       = squeeze * triggerRot;
        gameManager.drillTriggerSqueeze = squeeze;
        drillBit.Rotate(0, 0, squeeze * triggerRot, Space.Self);


        //sets pitch based on the value of the squeeze single
        drillSound.pitch = Mathf.Lerp(minPitch, maxPitch, squeeze);

        // drill soudn is always playing, sets vol based on value of squeeze
        drillSound.volume = Mathf.Lerp(minVol, maxVol, (squeeze / 2));
    }
Exemplo n.º 22
0
    void Update()
    {
        Ray        gunRay = new Ray(firePoint.transform.position, firePoint.transform.forward);
        RaycastHit hitInfo;

        if (Physics.Raycast(gunRay, out hitInfo, range))
        {
            Debug.DrawLine(gunRay.origin, hitInfo.point, Color.red);

            if (hitInfo.rigidbody != null)
            {
            }
        }
        else
        {
            Debug.DrawLine(gunRay.origin, gunRay.origin + gunRay.direction * range, Color.green);
        }

        if (interactable != null && interactable.attachedToHand != null)
        {
            if (grabPinchAction.GetState(SteamVR_Input_Sources.Any) && Time.time >= timeToFire)
            {
                timeToFire = Time.time + 1 / projectile.GetComponent <ProjectileMove>().fireRate;
                Shoot();
            }

            float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);

            if (triggerValue >= 1f)
            {
                //Shoot();
            }
        }
    }
Exemplo n.º 23
0
 // Update is called once per frame
 void Update()
 {
     //Menu button true/false
     if (SteamVR_Actions._default.Menu.GetStateDown(SteamVR_Input_Sources.Any))
     {
         print("Menu down");
     }
     //Teleport button true/false
     if (SteamVR_Actions._default.Teleport.GetStateDown(SteamVR_Input_Sources.Any))
     {
         print("Teleport down");
         //Toucpad location
         Vector2 touchPadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any);
         if (touchPadValue != Vector2.zero)
         {
             print(touchPadValue);
         }
     }
     //Trigger button true/false
     if (SteamVR_Actions._default.GrabPinch.GetStateDown(SteamVR_Input_Sources.Any))
     {
         print("Trigger down");
         //Triggerbutton Strength
         float triggervalue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);
         if (triggervalue >= 0.0f)
         {
             print(triggervalue);
         }
     }
 }
Exemplo n.º 24
0
        public override float GetFingerValue(HandType hand, FingerName finger)
        {
            var value = 0f;
            //value = (hand == HandType.right) ? right.fingers[(int)finger]:left.fingers[(int)finger];
            SteamVR_Input_Sources source = (hand == HandType.right) ? SteamVR_Input_Sources.RightHand : SteamVR_Input_Sources.LeftHand;

            switch (finger)
            {
            case FingerName.Thumb:
                value = thumb.GetAxis(source);
                break;

            case FingerName.Index:
                value = index.GetAxis(source);
                break;

            case FingerName.Middle:
                value = middle.GetAxis(source);
                break;

            case FingerName.Ring:
                value = ring.GetAxis(source);
                break;

            case FingerName.Pinky:
                value = pinky.GetAxis(source);
                break;

            default:
                break;
            }
            return(value);
        }
Exemplo n.º 25
0
    void Update()
    {
        if (SteamVR_Input._default.inActions.Teleport.GetStateDown(SteamVR_Input_Sources.Any))
        {
            // print("Teleport down");
        }

        if (SteamVR_Input._default.inActions.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any))
        {
            // print("Grab pinch down");
        }

        if (SteamVR_Input._default.inActions.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any))
        {
            //  print("Grab pinch up");
        }

        float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);

        if (triggerValue > 0f)
        {
            //print("Trigger value: " + triggerValue);
        }

        Vector2 touchpadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any);

        if (touchpadValue != Vector2.zero)
        {
            //print("Touchpad value: " + touchpadValue);
        }
    }
Exemplo n.º 26
0
    // Update is called once per frame
    void Update()
    {
        Vector2 steer = Vector2.zero;

        float throttle = 0;
        bool  reset    = false;
        bool  b_reset  = false;

        // get the inputs from the steamVR input system
        if (interactable.attachedToHand)
        {
            SteamVR_Input_Sources hand = interactable.attachedToHand.handType;

            steer    = actionSteering.GetAxis(hand);
            throttle = actionThrottle.GetAxis(hand);
            b_reset  = actionReset.GetState(hand);
            reset    = actionReset.GetStateDown(hand);
        }

        // animate the joystick
        modelJoystick.localRotation = joySRot;
        modelJoystick.Rotate(steer.y * -joystickRot, steer.x * -joystickRot, 0, Space.Self);
        modelTrigger.localRotation = trigSRot;
        modelTrigger.Rotate(throttle * -triggerRot, 0, 0, Space.Self);
        buttonReset.localScale = new Vector3(1, 1, b_reset ? 0.4f : 1.0f);

        // apply values to the drone
        drone.throttle    = throttle;
        drone.movementDir = steer;

        if (reset)
        {
            Reset();
        }
    }
Exemplo n.º 27
0
 //gets all controller input that we need
 private void GetInput()
 {
     pullAmount = triggerPull.GetAxis(hand);
     if (pullAmount < 0.5)
     {
         ReleaseObject();
     }
 }
Exemplo n.º 28
0
    public void customUpdate(CustomHand hand)
    {
        //Debug.Log(hand.handType); // returns LeftHand or RightHand
        switch (hand.handType.ToString())
        {
        case "LeftHand":
            l_Axis = triggerAxis.GetAxis(hand.handType);
            break;

        case "RightHand":
            r_Axis = triggerAxis.GetAxis(hand.handType) * -1;
            break;

        default:
            break;
        }
    }
Exemplo n.º 29
0
    // Update is called once per frame
    void Update()
    {
        if (head == null && GameObject.Find("(RenderWrapper Camera)") != null)
        {
            head = GameObject.Find("(RenderWrapper Camera)").transform;
        }
        Debug.DrawRay(rightController.position, rightController.forward, Color.red);
        bool rtVal = triggerAction.GetAxis(SteamVR_Input_Sources.RightHand) > 0.99f;
        bool ltVal = triggerAction.GetAxis(SteamVR_Input_Sources.LeftHand) > 0.99f;
        bool uval  = uAction.GetState(SteamVR_Input_Sources.RightHand);

        rightTriggerStatus = UpdatedButtonStatus(rightTriggerStatus, rtVal);
        leftTriggerStatus  = UpdatedButtonStatus(leftTriggerStatus, ltVal);
        unusedButtonStatus = UpdatedButtonStatus(unusedButtonStatus, uval);
        //Debug.Log(uval);
        //Debug.Log(unusedButtonStatus);
    }
Exemplo n.º 30
0
    // Update is called once per frame
    void Update()
    {
        // Get how much the trigger was pressed
        triggerValue = triggerAction.GetAxis(SteamVR_Input_Sources.Any);

        //if(triggerValue > 0.0f)
        //    Debug.Log("Trigger Value: " + triggerValue);
    }