private void Ungrab(bool carryMomentum, uint controllerIndex, GameObject target) { bodyPhysics.TogglePreventSnapToFloor(false); bodyPhysics.enableBodyCollisions = true; if (carryMomentum) { Vector3 velocity = Vector3.zero; var device = VRTK_DeviceFinder.GetControllerByIndex(controllerIndex, false); if (device) { velocity = -VRTK_DeviceFinder.GetControllerVelocity(device); if (usePlayerScale) { velocity = Vector3.Scale(velocity, playArea.localScale); } } bodyPhysics.ApplyBodyVelocity(velocity, true, true); } isClimbing = false; grabbingController = null; climbingObject = null; OnPlayerClimbEnded(SetPlayerClimbEvent(controllerIndex, target)); }
private void Ungrab(bool carryMomentum, uint controllerIndex) { bodyPhysics.TogglePreventSnapToFloor(false); bodyPhysics.enableBodyCollisions = true; if (carryMomentum) { Vector3 velocity = Vector3.zero; var device = VRTK_DeviceFinder.GetControllerByIndex(controllerIndex, false); if (device) { velocity = -VRTK_DeviceFinder.GetControllerVelocity(device); if (usePlayerScale) { velocity = Vector3.Scale(velocity, playArea.localScale); } } Vector3 throwVelocity = Vector3.ClampMagnitude(velocity * throwMultiplier, maxSpeed); if (throwVelocity.y <= 1) { throwVelocity.y = 1; } bodyPhysics.ApplyBodyVelocity(throwVelocity * throwMultiplier, true, true); } isClimbing = false; grabbingController = null; OnPlayerClimbEnded(SetPlayerClimbEvent(controllerIndex)); }
protected virtual void Ungrab(bool carryMomentum, VRTK_ControllerReference controllerReference, GameObject target) { bodyPhysics.TogglePreventSnapToFloor(false); bodyPhysics.enableBodyCollisions = true; if (carryMomentum) { Vector3 velocity = Vector3.zero; if (VRTK_ControllerReference.IsValid(controllerReference)) { velocity = -VRTK_DeviceFinder.GetControllerVelocity(controllerReference); if (usePlayerScale) { velocity = playArea.TransformVector(velocity); } else { velocity = playArea.TransformDirection(velocity); } } bodyPhysics.ApplyBodyVelocity(velocity, true, true); } isClimbing = false; grabbingController = null; climbingObject = null; OnPlayerClimbEnded(SetPlayerClimbEvent(controllerReference, target)); }
// Token: 0x06001827 RID: 6183 RVA: 0x000808EC File Offset: 0x0007EAEC protected virtual void Ungrab(bool carryMomentum, VRTK_ControllerReference controllerReference, GameObject target) { this.isClimbing = false; if (this.positionRewind != null && this.IsHeadsetColliding()) { this.positionRewind.RewindPosition(); } if (this.IsBodyColliding() && !this.IsHeadsetColliding()) { this.bodyPhysics.ForceSnapToFloor(); } this.bodyPhysics.enableBodyCollisions = true; if (carryMomentum) { Vector3 vector = Vector3.zero; if (VRTK_ControllerReference.IsValid(controllerReference)) { vector = -VRTK_DeviceFinder.GetControllerVelocity(controllerReference); if (this.usePlayerScale) { vector = this.playArea.TransformVector(vector); } else { vector = this.playArea.TransformDirection(vector); } } this.bodyPhysics.ApplyBodyVelocity(vector, true, true); } this.grabbingController = null; this.climbingObject = null; this.OnPlayerClimbEnded(this.SetPlayerClimbEvent(controllerReference, target)); }
private void UngrabDisc(bool carryMomentum, uint controllerIndex) { if (carryMomentum) { Vector3 velocity = Vector3.zero; var device = VRTK_DeviceFinder.GetControllerByIndex(controllerIndex, false); grabbedDisc.transform.rotation = Quaternion.Euler(new Vector3(90, 0, 0)); if (device) { velocity = VRTK_DeviceFinder.GetControllerVelocity(device); if (usePlayerScale) { velocity = Vector3.Scale(velocity, playArea.localScale); } } grabbedDiscRb.angularVelocity = new Vector3(0.0f, 100.0f, 0.0f); grabbedDiscRb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY; Vector3 throwVelocity = (velocity * throwMultiplier); grabbedDiscRb.velocity = (velocity * throwMultiplier); releaseDir = throwVelocity.normalized; } releasedDisc = grabbedDisc; releasedDiscRb = grabbedDiscRb; releasePos = VRTK_DeviceFinder.GetControllerByIndex(controllerIndex, false).transform.position; StartCoroutine(CountdownReleaseDisc()); grabbedDisc = null; grabbedDiscRb = null; }
protected virtual void Ungrab(bool carryMomentum, VRTK_ControllerReference controllerReference, GameObject target) { if (bodyPhysics == null) { return; } isClimbing = false; if (positionRewind != null && IsHeadsetColliding()) { positionRewind.RewindPosition(); } if (IsBodyColliding() && !IsHeadsetColliding()) { bodyPhysics.ForceSnapToFloor(); } bodyPhysics.enableBodyCollisions = true; if (carryMomentum) { Vector3 velocity = Vector3.zero; if (VRTK_ControllerReference.IsValid(controllerReference)) { velocity = -VRTK_DeviceFinder.GetControllerVelocity(controllerReference); if (usePlayerScale) { velocity = playArea.TransformVector(velocity); } else { velocity = playArea.TransformDirection(velocity); } } bodyPhysics.ApplyBodyVelocity(velocity, true, true); } grabbingController = null; climbingObject = null; OnPlayerClimbEnded(SetPlayerClimbEvent(controllerReference, target)); }
public static Vector3 GetControllerVelocity(GameObject givenController) { return(VRTK_DeviceFinder.GetControllerVelocity(VRTK_ControllerReference.GetControllerReference(givenController))); }