//-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                hand.HoverLock(GetComponent <Interactable> ());

                initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform);
                sampleCount          = 0;
                mappingChangeRate    = 0.0f;
                onAttachedToHand.Invoke();
            }

            if (hand.GetStandardInteractionButtonUp())
            {
                hand.HoverUnlock(GetComponent <Interactable> ());

                CalculateMappingChangeRate();
                onDetachedFromHand.Invoke();
            }

            if (hand.GetStandardInteractionButton())
            {
                UpdateLinearMapping(hand.transform);
            }
        }
Ejemplo n.º 2
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         this.PhysicsAttach(hand);
     }
 }
Ejemplo n.º 3
0
        //Change this to VR
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject == Leversobj_1)
                {
                    // Save our position/rotation so that we can restore it when we detach
                    oldPosition = Levers_1.position;
                    oldRotation = Levers_1.rotation;

                    // Call this to continue receiving HandHoverUpdate messages,
                    // and prevent the hand from hovering over anything else
                    hand.HoverLock(leverinter_1);

                    // Attach this object to the hand
                    hand.AttachObject(Leversobj_1, attachmentFlags);
                    Levers_1.Rotate(Vector3.right, -3f);
                }
                if (hand.currentAttachedObject == Leversobj_2)
                {
                    // Save our position/rotation so that we can restore it when we detach
                    oldPosition = Levers_2.position;
                    oldRotation = Levers_2.rotation;

                    // Call this to continue receiving HandHoverUpdate messages,
                    // and prevent the hand from hovering over anything else
                    hand.HoverLock(leverinter_2);

                    // Attach this object to the hand
                    hand.AttachObject(Leversobj_2, attachmentFlags);
                    Levers_2.Rotate(Vector3.right, -3f);
                }
            }
        }
Ejemplo n.º 4
0
        //-------------------------------------------------
        // Called every Update() while a Hand is hovering over this object
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    // // Save our position/rotation so that we can restore it when we detach
                    // oldPosition = transform.position;
                    // oldRotation = transform.rotation;

                    // // Call this to continue receiving HandHoverUpdate messages,
                    // // and prevent the hand from hovering over anything else
                    // hand.HoverLock( GetComponent<Interactable>() );

                    // // Attach this object to the hand
                    // hand.AttachObject( gameObject, attachmentFlags );
                    GameObject player = GameObject.FindGameObjectWithTag("Player");
                    player.GetComponent <ItemController>().CollectKey(gameObject.GetComponent <BoxCollider>());
                }
                // else
                // {
                //  // // Detach this object from the hand
                //  // hand.DetachObject( gameObject );

                //  // // Call this to undo HoverLock
                //  // hand.HoverUnlock( GetComponent<Interactable>() );

                //  // // Restore position/rotation
                //  // transform.position = oldPosition;
                //  // transform.rotation = oldRotation;
                // }
            }
        }
Ejemplo n.º 5
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         hand.AttachObject(gameObject, attachmentFlags, attachmentPoint);
     }
 }
Ejemplo n.º 6
0
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                // Trigger was just pressed
                lastHandProjected = ComputeToTransformProjected(hand.hoverSphereTransform);

                if (hoverLock)
                {
                    hand.HoverLock(GetComponent <Interactable>());
                    handHoverLocked = hand;
                }

                driving = true;

                ComputeAngle(hand);
                UpdateAll();

                ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
            }
            else if (hand.GetStandardInteractionButtonUp())
            {
                // Trigger was just released
                if (hoverLock)
                {
                    hand.HoverUnlock(GetComponent <Interactable>());
                    handHoverLocked = null;
                }
            }
            else if (driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == GetComponent <Interactable>())
            {
                ComputeAngle(hand);
                UpdateAll();
            }
        }
Ejemplo n.º 7
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         this.lastHandProjected = this.ComputeToTransformProjected(hand.hoverSphereTransform);
         if (this.hoverLock)
         {
             hand.HoverLock(base.GetComponent <Interactable>());
             this.handHoverLocked = hand;
         }
         this.driving = true;
         this.ComputeAngle(hand);
         this.UpdateAll();
         ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
         {
             EVRButtonId.k_EButton_Axis1
         });
     }
     else if (hand.GetStandardInteractionButtonUp())
     {
         if (this.hoverLock)
         {
             hand.HoverUnlock(base.GetComponent <Interactable>());
             this.handHoverLocked = null;
         }
     }
     else if (this.driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == base.GetComponent <Interactable>())
     {
         this.ComputeAngle(hand);
         this.UpdateAll();
     }
 }
Ejemplo n.º 8
0
        //-------------------------------------------------
        // Called every Update() while a Hand is hovering over this object
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    // Save our position/rotation so that we can restore it when we detach
                    oldPosition = transform.position;
                    oldRotation = transform.rotation;

                    // Call this to continue receiving HandHoverUpdate messages,
                    // and prevent the hand from hovering over anything else
                    hand.HoverLock(GetComponent <Interactable>());

                    // Attach this object to the hand
                    hand.AttachObject(topping, attachmentFlags);
                }
                else
                {
                    // Detach this object from the hand
                    hand.DetachObject(topping);

                    // Call this to undo HoverLock
                    hand.HoverUnlock(GetComponent <Interactable>());

                    // Restore position/rotation
                    transform.position = oldPosition;
                    transform.rotation = oldRotation;
                }
            }
        }
Ejemplo n.º 9
0
        private void HandHoverUpdate(Hand hand)
        {
            if (canPickUp)
            {
                if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
                {
                    //Stuff
                    if (hand.currentAttachedObject != gameObject)
                    {
                        oldPosition = transform.position;
                        oldRotation = transform.rotation;
                        //Keeps hover update function going
                        hand.HoverLock(GetComponent <Interactable> ());

                        hand.AttachObject(gameObject, attatchmentFlags);
                    }
                    else
                    {
                        hand.DetachObject(gameObject);

                        hand.HoverUnlock(GetComponent <Interactable> ());

                        //Would be replaced with activating RigidBody
                        transform.position = oldPosition;
                        transform.rotation = oldRotation;
                    }
                }
            }
        }
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                steering = true;
                hand.HoverLock(GetComponent <Interactable>());

                initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform);
                sampleCount          = 0;
                mappingChangeRate    = 0.0f;
            }

            if (hand.GetStandardInteractionButtonUp())
            {
                steering = false;
                hand.HoverUnlock(GetComponent <Interactable>());

                CalculateMappingChangeRate();
            }

            if (hand.GetStandardInteractionButton())
            {
                UpdateLinearMapping(hand.transform);
            }
        }
Ejemplo n.º 11
0
 //-------------------------------------------------
 // Called every Update() while a Hand is hovering over this object
 //-------------------------------------------------
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
     {
         //textMesh.text = "Trigerred";
         configurator.loadTerrain(GetComponentInChildren <TextMesh>().text);
     }
 }
Ejemplo n.º 12
0
 //-------------------------------------------------
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         InputModule.instance.Submit(gameObject);
         ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
     }
 }
Ejemplo n.º 13
0
 //-------------------------------------------------
 private void HandHoverUpdate(Hand hand)
 {
     //Trigger got pressed
     if (hand.GetStandardInteractionButtonDown())
     {
         hand.AttachObject(gameObject, attachmentFlags, attachmentPoint);
         ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
     }
 }
        //-------------------------------------------------
        // Called every Update() while a Hand is hovering over this object
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GuessCurrentHandType() == Hand.HandType.Right)
            {
                //  Trigger gets pulled
                if (hand.GetStandardInteractionButtonDown())
                {
                    //  Hand is not already holding this object
                    if (hand.currentAttachedObject != gameObject)
                    {
                        //  Hand is hovering over toolbox item
                        if (isFake)
                        {
                            //  Spawn a new item and attach it
                            GameObject newPiece = Instantiate(gMan.tools[pieceIndex]) as GameObject;
                            //newPiece.transform.localScale *= growthMod;
                            newPiece.transform.position = hand.transform.position;
                            newPiece.transform.rotation = hand.transform.rotation;
                            newPiece.GetComponent <Movable>().isFake = false;

                            // Call this to continue receiving HandHoverUpdate messages,
                            // and prevent the hand from hovering over anything else
                            hand.HoverLock(newPiece.GetComponent <Interactable>());

                            // Attach this object to the hand
                            hand.AttachObject(newPiece, newPiece.GetComponent <Movable>().attachmentFlags);
                        }
                        else
                        {
                            // Call this to continue receiving HandHoverUpdate messages,
                            // and prevent the hand from hovering over anything else
                            hand.HoverLock(GetComponent <Interactable>());

                            //  Unsnap in case
                            if (this.GetComponent <SnappingScript>())
                            {
                                GetComponent <SnappingScript>().Unsnap();
                            }

                            //this.GetComponentInChildren<MeshCollider>().convex = false;

                            //  if it's the ball enable physics
                            if (this.GetComponentInChildren <Ball>())
                            {
                                this.GetComponentInChildren <Rigidbody>().isKinematic = true;
                            }

                            // Attach this object to the hand
                            hand.AttachObject(gameObject, attachmentFlags);
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         InputModule.instance.Submit(base.gameObject);
         ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
         {
             EVRButtonId.k_EButton_Axis1
         });
     }
 }
Ejemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        Camera cam = Player.GetComponent <Camera>();

        if (hand.GetStandardInteractionButtonDown())
        {
            Rigidbody instance;
            instance = Instantiate(Las.GetComponent <Rigidbody>(), cam.transform.position, cam.transform.rotation) as Rigidbody;
            instance.AddForce(cam.transform.forward * speed);
        }
    }
Ejemplo n.º 17
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         hand.AttachObject(base.gameObject, this.attachmentFlags, this.attachmentPoint);
         ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
         {
             EVRButtonId.k_EButton_Axis1
         });
     }
 }
Ejemplo n.º 18
0
 // Use controller to control the ball
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
     {
         if (hand.currentAttachedObject == ball)
         {
             hand.HoverLock(ballinter);
             hand.AttachObject(ball, attachmentFlags);
         }
     }
 }
Ejemplo n.º 19
0
        //void Update()
        //{
        //    if (Input.GetKeyDown(KeyCode.R))
        //    {
        //        ToggleRagdoll();
        //    }
        //}

        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                if (isKinematic)
                {
                    ToggleRagdoll();
                }
                //StartCoroutine("LateAttach", hand);
                throwable.PhysicsAttach(hand);
            }
        }
Ejemplo n.º 20
0
 //-------------------------------------------------
 // Called every Update() while a Hand is hovering over this object
 //-------------------------------------------------
 public void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown() ||
         ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
     {
         if (m_canTriggerEvents)
         {
             m_canTriggerEvents = false;
             m_material.SetColor("_EmissionColor", m_clickColor);
             onClick.Invoke();
         }
     }
 }
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                if (CashMachineController.Instance.AmountLeft == 0)
                {
                    //Debug.Log("good to go " + CashMachineController.Instance.AmountChange);
                    int score = CashMachineController.Instance.AmountChange * 10 + (int)TimerController.Instance.time;
                    PreviousScoresController.Instance.AddPrevScore(score);

                    LoadNextSceneButton.SetActive(true);
                    LoadNextSceneButton.GetComponentInChildren <TextMeshPro>().text = $"Your score was : {score}. \n Press here to restart.";
                    //SceneManager.LoadScene(SceneManager.GetActiveScene().name);
                }
            }
        }
Ejemplo n.º 22
0
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                if (!IsActivated)
                {
                    onSwitchActivated.Invoke();
                }
                else
                {
                    onSwitchDeactivated.Invoke();
                }

                IsActivated = !IsActivated;
            }
        }
Ejemplo n.º 23
0
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    hand.HoverLock(GetComponent <Interactable>());

                    hand.AttachObject(gameObject, attachmentFlags);
                }
            }
            else if (hand.GetStandardInteractionButtonUp())
            {
                hand.DetachObject(gameObject);

                hand.HoverUnlock(GetComponent <Interactable>());
            }
        }
Ejemplo n.º 24
0
 // Token: 0x060021DB RID: 8667 RVA: 0x000A7928 File Offset: 0x000A5B28
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown() || (hand.controller != null && hand.controller.GetPressDown(EVRButtonId.k_EButton_Grip)))
     {
         if (hand.currentAttachedObject != base.gameObject)
         {
             this.oldPosition = base.transform.position;
             this.oldRotation = base.transform.rotation;
             hand.HoverLock(base.GetComponent <Interactable>());
             hand.AttachObject(base.gameObject, this.attachmentFlags, "");
             return;
         }
         hand.DetachObject(base.gameObject, true);
         hand.HoverUnlock(base.GetComponent <Interactable>());
         base.transform.position = this.oldPosition;
         base.transform.rotation = this.oldRotation;
     }
 }
Ejemplo n.º 25
0
 // Token: 0x06005CDE RID: 23774 RVA: 0x00206C54 File Offset: 0x00205054
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         hand.HoverLock(base.GetComponent <Interactable>());
         this.initialMappingOffset = this.linearMapping.value - this.CalculateLinearMapping(hand.transform);
         this.sampleCount          = 0;
         this.mappingChangeRate    = 0f;
     }
     if (hand.GetStandardInteractionButtonUp())
     {
         hand.HoverUnlock(base.GetComponent <Interactable>());
         this.CalculateMappingChangeRate();
     }
     if (hand.GetStandardInteractionButton())
     {
         this.UpdateLinearMapping(hand.transform);
     }
 }
Ejemplo n.º 26
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
     {
         if (hand.currentAttachedObject != gameObject)
         {
             hand.HoverLock(GetComponent <Interactable>());
             hand.AttachObject(gameObject, attachmentFlags);
             GetComponentInChildren <Collider>().gameObject.layer = LayerMask.NameToLayer("IgnoreTeleport");
             hand.GetComponentInChildren <HandControllerState>().gameObject.SetActive(false);
         }
         else
         {
             hand.DetachObject(gameObject);
             hand.HoverUnlock(GetComponent <Interactable>());
             GetComponentInChildren <Collider>().gameObject.layer = LayerMask.NameToLayer("Default");
             hand.GetComponentInChildren <HandControllerState>(true).gameObject.SetActive(true);
         }
     }
 }
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetTrackedObjectVelocity().magnitude >= petVelocity && !canBeHit)
     {
         if (canBePet)
         {
             Debug.Log("petting monster");
             StartCoroutine("PettingRefresh");
         }
     }
     if (hand.GetStandardInteractionButtonDown())
     {
         StartCoroutine("AddButtonPress");
         if (buttonPresses > 2 && canBePet)
         {
             StartCoroutine("PettingRefresh");
             buttonPresses = 0;
         }
     }
 }
Ejemplo n.º 28
0
        //-------------------------------------------------
        // Called every Update() while a Hand is hovering over this object
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    hand.HoverLock(GetComponent <Interactable>());

                    // Attach this object to the hand
                    hand.AttachObject(gameObject, attachmentFlags);
                }
                else
                {
                    // Detach this object from the hand
                    hand.DetachObject(gameObject);

                    // Call this to undo HoverLock
                    hand.HoverUnlock(GetComponent <Interactable>());
                }
            }
        }
Ejemplo n.º 29
0
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            //Trigger got pressed
            if (hand.GetStandardInteractionButtonDown())
            {
                plateAnimator.SetTrigger("plateCollision");

                plateIndex = Random.Range(0, 3);
//				GameObject plateOnHand = Instantiate (plates[plateIndex]);
                GameObject plateOnHand = Instantiate(plates[plateIndex], new Vector3(hand.transform.position.x, hand.transform.position.y, hand.transform.position.z), new Quaternion(0, 0, 0, 0));
//				hand.AttachObject (plateOnHand, Hand.AttachmentFlags.ParentToHand, attachmentPoint);
//				hand.Attac

                //go plate = Instantiate plate prefab code
                //hand.attchObject(plate)


                //hand.AttachObject( gameObject, attachmentFlags, attachmentPoint );
                ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
            }
        }
Ejemplo n.º 30
0
        private void HandHoverUpdate(Hand hand)
        {
            UnityEngine.Debug.Log("Hover");
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    UnityEngine.Debug.Log("Attatch");
                    //Orienting to hand
                    this.transform.position = hand.transform.position;
                    this.transform.rotation = Quaternion.Euler(hand.transform.rotation.eulerAngles + grabOrientation);

                    //Locking for detatchment
                    hand.HoverLock(GetComponent <Interactable>());
                    hand.AttachObject(gameObject, attatchmentFlags);

                    //Used for velocity gathering
                    isActive = true;

                    //Connecting to hand with Joint
                    //CreateHandJoint();
                    //handJoint.connectedBody = hand.GetComponent<Rigidbody>();
                }
            }
            else if (hand.GetStandardInteractionButtonUp() || ((hand.controller != null) && hand.controller.GetPressUp(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject == gameObject)
                {
                    UnityEngine.Debug.Log("Detatch");
                    hand.DetachObject(gameObject);

                    hand.HoverUnlock(GetComponent <Interactable> ());

                    isActive = false;

                    //Disconnecting handJoint
                    //Destroy(handJoint);
                }
            }
        }