private void ReleaseObject() { if (GetComponent <FixedJoint>()) { GetComponent <FixedJoint>().connectedBody = null; Destroy(GetComponent <FixedJoint>()); // TODO: Fix this so that it throws with the correct velocity applied //objectInHand.GetComponent<Rigidbody>().velocity = GetComponent<Rigidbody>().velocity; //objectInHand.GetComponent<Rigidbody>().angularVelocity = GetComponent<Rigidbody>().angularVelocity; //objectInHand.GetComponent<Rigidbody>().velocity = Controller.velocity; //objectInHand.GetComponent<Rigidbody>().angularVelocity = Controller.angularVelocity; #if SteamVR_Legacy objectInHand.GetComponent <Rigidbody>().velocity = Controller.velocity * Vector3.Distance(Controller.transform.pos, objectInHand.transform.position); objectInHand.GetComponent <Rigidbody>().angularVelocity = Controller.angularVelocity; #elif SteamVR_2 objectInHand.GetComponent <Rigidbody>().velocity = theController.GetVelocity() * Vector3.Distance(theController.transform.position, objectInHand.transform.position); objectInHand.GetComponent <Rigidbody>().angularVelocity = theController.GetAngularVelocity(); #endif } objectInHand = null; }
private void ReleaseObject() { if (GetComponent <FixedJoint>()) { GetComponent <FixedJoint>().connectedBody = null; Destroy(GetComponent <FixedJoint>()); #if SteamVR_Legacy lastSelectedObject.GetComponent <Rigidbody>().velocity = Controller.velocity; lastSelectedObject.GetComponent <Rigidbody>().angularVelocity = Controller.angularVelocity; #elif SteamVR_2 lastSelectedObject.GetComponent <Rigidbody>().velocity = trackedObj.GetVelocity(); lastSelectedObject.GetComponent <Rigidbody>().angularVelocity = trackedObj.GetAngularVelocity(); #endif } }
private void ReleaseObject() { if (GetComponent <FixedJoint>()) { GetComponent <FixedJoint>().connectedBody = null; Destroy(GetComponent <FixedJoint>()); #if SteamVR_Legacy objectInHand.GetComponent <Rigidbody>().velocity = Controller1.velocity; objectInHand.GetComponent <Rigidbody>().angularVelocity = Controller1.angularVelocity; #elif SteamVR_2 objectInHand.GetComponent <Rigidbody>().velocity = trackedObj1.GetVelocity(); objectInHand.GetComponent <Rigidbody>().angularVelocity = trackedObj1.GetAngularVelocity(); #endif } droppedObject.Invoke(); objectInHand = null; }
private void ReleaseObject() { if (trackedObj.GetComponent <FixedJoint>()) { trackedObj.GetComponent <FixedJoint>().connectedBody = null; Destroy(trackedObj.GetComponent <FixedJoint>()); objectInHand.GetComponent <Rigidbody>().useGravity = true; #if SteamVR_Legacy objectInHand.GetComponent <Rigidbody>().velocity = Controller.velocity; objectInHand.GetComponent <Rigidbody>().angularVelocity = Controller.angularVelocity; #elif SteamVR_2 objectInHand.GetComponent <Rigidbody>().velocity = trackedObj.GetVelocity(); objectInHand.GetComponent <Rigidbody>().angularVelocity = trackedObj.GetAngularVelocity(); #endif } objectInHand = null; }