Oculus Haptic Feedback

Oculus Haptic Feedback

Why you need it and how to get started quickly

Vive & Oculus Haptic feedback systems are extremely important and often overlooked…  On a pretty usual basis, they get overlooked or added in last second (I’m guilty of that myself).

Adding just a little haptic feedback in the right places gives a huge boost to immersion, and leaving it out gives the feeling that something just isn’t quite right.

Why’s it hard?

SteamVR haptics on touch controllers don’t work at all…. (at least at the time of this writing)

Recently, Oculus changed their haptic system, breaking my old code when I upgraded the SDK….

So I’ve written a wrapper.  It handles haptics for either system, and makes it extremely easy.

For this post, I won’t dig into the entire cross platform wrapper, but will instead give you the basics to get started with Oculus haptics in a quick and easy way.

Prerequisites (Oculus)

For this to work, you’ll need the oculus utilities for Unity in your project.

https://developer3.oculus.com/downloads/game-engines/1.11.0/Oculus_Utilities_for_Unity_5/

Shared Code

In the more complete version of my projects, I have quite a bit of shared code and swap between implementations with #defines.

For this simplified sample though, we still have one piece of shared code.  That code is an enum which specifies how strong the feedback vibration effect should be.

The Code (Oculus)

The Oculus code is designed to bypass the need for custom audioclips.  While the clip system is pretty cool and could do quite a bit, it’s not cross platform, and much harder to get started with in my opinion.

 

In the code, we generate 3 OVRHapticsClips named clipLight, clipMedium, & clipHard..  As you may have guessed, these correspond to our enum values.

Use (Oculus)

To use the haptics code, add the script to your controller object.

Assign the controller mask as L Touch or R Touch (whichever matches the controller it’s attached to).

Then call the Vibrate method when you want it to shake.

Demo (Oculus)

If you’re not quite sure how you’d use the code, here’s a real quick sample.  Ideally, you’d have something per controller, managing events for the controller, like a generic VR Controller script that ties these all together and works cross platform.

But to get you started quickly, here’s a simple sample that will vibrate the controllers when you press space.  (just remember to assign the 2 controllers)

What about the Vive?

I’ll cover Vive haptics soon, likely with a more generic implementation that you can use across both platforms.

If you’re really interested in Vive development though, I’m working on a quick weekend long guide that covers everything you need to know to get started, including haptics.  Just sign up (at the top of this post) and I’ll get you the info as soon as it’s ready.