-
Notifications
You must be signed in to change notification settings - Fork 1
Haptics Controller
caxawu edited this page Aug 16, 2020
·
2 revisions
The haptics controller is for triggering controller haptics. It leverages OVR's controller haptics, but includes a parameter for haptic duration.
- Drag in the HapcticsController prefab located in
Assets->Prefabs->PlayerInteraction->HapticsController
. This prefab is just an empty gameobject with the HapticsController script attached. - In the script where you want to use haptics, create an instance of the haptics controller:
_hapticsController = HapticsController.Instance; if (_hapticsController == null) throw new System.Exception("Must have a haptics controller in the scene");
In your script, call:
_hapticsController.Haptics(float frequency, float amplitude, float duration, OVRInput.Controller controller);
Frequency: Refers to how frequent the vibration is (any value between 0 and 1 inclusive): this value will most likely not need to be changed
Amplitude: Refers to the strength of the vibration (any value between 0 and 1 inclusive)
Duration: Refers to how long the haptic feedback lasts (any value between 0 and 1 inclusive)
Controller: Refers to which controller the haptic feedback happens on
_hapticsController.Haptics(1, 0.25f, 0.1f, OVRInput.Controller.RTouch);