Exemplo n.º 1
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Hand")
        {
            this.cursorRenderer.material = TestingMaterial;
            if (this.device.GetPressDown(EVRButtonId.k_EButton_SteamVR_Trigger) && grabJoint.connectedBody == null)
            {
                Debug.Log("3");
                grabJoint.connectedBody = other.GetComponent <Rigidbody>();
            }
        }
        else
        {
            this.cursorRenderer.material = DefaultMaterial;
        }
        if (other.tag == "LiveHand")
        {
            this.cursorRenderer.material = ActiveMaterial;
            if (this.device.GetPressDown(EVRButtonId.k_EButton_SteamVR_Trigger) && this.liveHand == null)
            {
                this.liveHand = other.gameObject;

                BleedFX bleedFX = liveHand.GetComponentInChildren <BleedFX>();
                if (bleedFX != null)
                {
                    bleedFX.PickedUp();
                }
            }
        }
    }
Exemplo n.º 2
0
    void OnTriggerExit(Collider other)
    {
        Debug.Log("Exited " + other.tag);
        if (this.liveHand == other.gameObject)
        {
            other.gameObject.GetComponent <LiveHandBehaviour>().doctor.RipOffRand();
            Debug.Log("Ripped hand " + this.gameObject.name);
            GameObject hand = Instantiate(HandPrefab);
            hand.transform.position = this.ArmSpawnerMarker.transform.position;
            hand.transform.rotation = this.ArmSpawnerMarker.transform.rotation;
            //hand.transform.position += new Vector3(0, 0, 1f);
            hand.transform.parent        = this.HandParent.transform;
            this.grabJoint.connectedBody = hand.GetComponent <HandBehaviour>().holdableRigidbody;

            BleedFX bleedFX = liveHand.GetComponentInChildren <BleedFX>();
            if (bleedFX != null)
            {
                bleedFX.Dropped();
            }

            this.liveHand = null;
            StartCoroutine(LongVibration(1, 3999));
            //SteamVR_Controller.Input(4).TriggerHapticPulse(3000);

            //GetComponent<SteamVR_TrackedObject>().index.get
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        if (grabJoint.connectedBody != null && !this.device.GetPress(EVRButtonId.k_EButton_SteamVR_Trigger))
        {
            Rigidbody rigidbody = grabJoint.connectedBody;
            rigidbody.velocity        = device.velocity;
            rigidbody.angularVelocity = device.angularVelocity;
            grabJoint.connectedBody   = null;
        }
        if (this.liveHand != null && !this.device.GetPress(EVRButtonId.k_EButton_SteamVR_Trigger))
        {
            this.liveHand = null;
            BleedFX bleedFX = liveHand.GetComponentInChildren <BleedFX>();
            if (bleedFX != null)
            {
                bleedFX.Dropped();
            }
        }

        /*if(this.device.GetPress(EVRButtonId.k_EButton_SteamVR_Trigger))
         * {
         *  this.cursorRenderer.material = ActiveMaterial;
         * } else
         * {
         *  this.cursorRenderer.material = DefaultMaterial;
         * }*/
    }