public override bool SetRumble(XRControllerRumbleSide controller, float strength, float duration) { if (strength < 0) { strength = 0; } if (strength > 1) { strength = 1; } if (duration < 0) { duration = 0; } if (leftHand >= 0 && (controller == XRControllerRumbleSide.Left || controller == XRControllerRumbleSide.Both)) { input.TriggerHapticVibrationAction(viveAction_Rumble_LeftHand, 0, duration, 1, strength, 0); } if (rightHand >= 0 && (controller == XRControllerRumbleSide.Right || controller == XRControllerRumbleSide.Both)) { input.TriggerHapticVibrationAction(viveAction_Rumble_RightHand, 0, duration, 1, strength, 0); } return(true); }
public override bool SetRumble(XRControllerRumbleSide controller, float strength, float duration) { if (strength < 0) { strength = 0; } if (strength > 1) { strength = 1; } if (duration < 0) { duration = 0; } if (leftHand >= 0 && (controller == XRControllerRumbleSide.Left || controller == XRControllerRumbleSide.Both)) { system.TriggerHapticPulse((uint)leftHand, 0, (ushort)(duration * 1000000)); } if (rightHand >= 0 && (controller == XRControllerRumbleSide.Right || controller == XRControllerRumbleSide.Both)) { system.TriggerHapticPulse((uint)rightHand, 0, (ushort)(duration * 1000000)); } return(true); }
public static bool SetRumble(XRControllerRumbleSide controller, float strength, float duration = .1f) { if (singleton == null) { return(false); } return(singleton.api.SetRumble(controller, strength, duration)); }
public override bool SetRumble(XRControllerRumbleSide controller, float strength, float duration) { if (strength < 0) { strength = 0; } if (strength > 1) { strength = 1; } if (duration < 0) { duration = 0; } if (controller == XRControllerRumbleSide.Left || controller == XRControllerRumbleSide.Both) { HapticCapabilities capabilities; if (handLeft.TryGetHapticCapabilities(out capabilities)) { if (capabilities.supportsImpulse) { return(handLeft.SendHapticImpulse(XRInput.singleton.rumbleChannel, strength, duration)); } } } if (controller == XRControllerRumbleSide.Right || controller == XRControllerRumbleSide.Both) { HapticCapabilities capabilities; if (handRight.TryGetHapticCapabilities(out capabilities)) { if (capabilities.supportsImpulse) { return(handRight.SendHapticImpulse(XRInput.singleton.rumbleChannel, strength, duration)); } } } return(false); }
public virtual bool SetRumble(XRControllerRumbleSide controller, float strength, float duration) { return(false); }