Adding Oculus to our HTCVIVE project!

Welcome to Fantabula!

The story of how we made one of our scenes work with the Oculus as well as HTCVIVE.

USE VRTK

We picked VRTK to get us around in VR, firstly, because there were a lot of ready scripts for awesome UI interaction, but secondly, because it could switch between VIVE/OpenVR and Oculus headset use. Or … that was the hype.

Now, we see how it plays out.

Keep in mind that VRTK development stopped being developed for over a year, but then just in April 2018 Oculus funded it to continue. This is good news, but I don’t think it’s been updated yet for the latest Unity. But that’s partly why I’m still running Unity v. 2017.1.1f1.

More evidence to support this article:

Why You Should Use VRTK as your SDK

So, what do you have to do, once you’ve installed VRTK in order to activate the Oculus so it will work?

CONVERTING THE GAME TO WORK WITH OCULUS

First, I just exported one scene of our game, Fantabula, to try the Oculus SDK in. Right now, Fantabula is running in OpenVR / SteamVR and compatible with the VIVE, using VRTK SDK. There are 5 scenes (including our own credit scene–that’s right–a separate scene for our credits, but I didn’t want to complicate this (more than it is). See our article:.

Lareena’s Amazing Credits Room

 

We had tried it previously and had some trouble, mostly doing the build. This took an incredibly long time and at first we thought this had been caused by the Oculus SDK so we took it out. But it took the same amount of time to build without it, so I concluded that it wasn’t the fault of the Oculus SDK.

 

Hence, the decision to try again.


The other hesitation is that I’m a VIVE user, as is Carolyn. I don’t have the Oculus, and Carolyn had an old version without working controllers. So, debugging would be extra difficult. But we decided to call for some help trying it out, using Reddit.

 

OUR REDDIT PLEA:

https://www.reddit.com/r/oculus/comments/8zoy91/request_for_a_tester/

 

Those who helped us try it out said that it was working for them.

Here is the process I used to get it working on both platforms.

 

Just to make sure I had the latest VRTK and SteamVR, I deleted those and reinstalled them. I had to make a few adjustments to my scene (I had chosen “Kezaria” for this) in order to make it work as a standalone scene.

 

I used the following VRTK tutorial to help me install the Oculus SDK.

GETTING STARTED WITH THE OCULUS SDK

Tutorial:  

 

 

GETTING STARTED WITH THE OCULUS AVATAR

 

 

This involves going to the Oculus site and downloading two packages, first the Oculus OVR and secondly, the OVR Avatar SDK. In the above tutorials, he says that it’s not compatible with the latest version of those packages and suggests an earlier version. However, the tutorial was over a year ago, so I decided to go with the latest of each and hope those bugs had been ironed out. And so far, it seems to be working. If you try it and run into trouble, try dialing it back to the recommended version.

 

GOT A TON OF ERRORS

The first time I imported these Oculus OVR / Avatar. I got a sh@t ton of errors, most of them seemingly linked to the Oculus “Samples” folder. So I deleted it, and the errors vanished. Voila!

 

USING VRTK

Please note, I’m using VRTK to build the player in all these scenes and it is the backbone of using both the VIVE/OpenVR along with the Oculus together in one app. You can enjoy the magic of this yourself by downloading “VRTK” from the Unity Asset store. Then check out all the detailed tutorials beginning with:

Teleporting 001: The Basics

 

 

MY VERSION OF UNITY

Also, please note that I am using an older version of Unity, namely: v. 2017.1.1f1.

I’ve been designing this game for over a year and we worried that updating might bring about more incompatibilities (especially since we were using VRTK and for awhile they had stopped development), so we decided to wait until we finished this game. So, things might go differently with a newer version of Unity.

 

OCULUS “NOT ENABLED”

I looked under the VRTK_SDKManager that I’d set up and saw that Oculus was not “enabled”. I went to BuildSettings, then PlayerSettings and added Oculus to the VirtualReality SDK’s. I put this first, figuring that, after all, this was the Oculus version. I made a build and … it didn’t work. I went back to troubleshoot. I discovered that my “SDKSetupSwitcher” had been disabled, so I clicked that back on. Also, I went back in and read some about the problem via the internet. Found a helpful article that said that “OpenVR” must be first in the list. Then I reordered it, and–presto–it worked!

 

HELPFUL TROUBLESHOOTING LINK

THE STONE FOX / VRTK

https://github.com/thestonefox/VRTK/issues/1236

 

TIDY UP THE OCULUS SDK

The setup for the Oculus will need to be finessed a bit. Either you need to add an “OculusVR” VRTK setup, or, if you did like I do (lazily copy the setup from the Sample scenes of VRTK) then you will need to go back to the Sample scenes (for some reason this works) copy out just the “OculusVR” portion (under “VRTK_SDKManager/SDKsetup” and delete the corresponding one in your scene and replace it with the new one. This fixed my problems.

 

Now, it was ready to try out. So I uploaded it for Carolyn.

 

CAROLYN’S AVATAR FALLS TO HER DEATH

So, the first build we did: Carolyn fell to her death. Her avatar started somewhere in the sky and fell infinitely down. So, back to the drawing board.

 

I’ve had this problem before and checked the “OculusVR” piece of the “SDKSetup”. Sure enough, it was at the edge of my map, instead of in the center, where my “SteamVR” setup had been placed. Make sure that the “OculusVR” and the “SDKSetup” transform are both set to 0,0,0. “OculusVR” is a child of “SDKSetup” and that is a child of “VRTK_SDKManager” and that one is set to the exact location in the game that you want.

 

When I repositioned it and tried again–Carolyn survived!

 

When you go to build the program, double check the Build Settings / Player Settings and make sure “OpenVR” is at the top, because, for some stupid reason, “None” keeps repopulating at the top. I hate that. Always check it.

 

We ended up building each scene separately then doing it together as a whole because once you’ve built the scene, it goes much faster the second time. Also, we deleted our library prior to doing either of those things, just to have a fresh version.

 

Once we did all those things and uploaded it to Itch.io and linked that to the Reddit page, we got responses saying that it did work, which was very gratifying.

The Monster
The Monster

FANTABULA ON ITCH.IO        (VIVE)

https://accidentalwizardry.itch.io/fantabula

This is the VIVE only version

 

KEZARIA ON ITCH.IO         (Oculus & VIVE)

https://accidentalwizardry.itch.io/kezaria-for-oculus

This is the Oculus version, but it should also work with the VIVE. That remains to be tested, and much more testing will need to take place before we get too complacent that our work has been done.

Try out our program, and let us know what you think — we are eager for feedback!

 

 

 

 

Why You Should Use VRTK as your SDK

WHY VRTK?

Because it’s brilliant, that’s why. Also, it can support a wide variety of formats the most important (for me) being VIVE and Oculus. These were the two main platforms that we wanted to come out on.

Once I learned to create a world in Unity, I couldn’t rest until I’d looked at it in my new VIVE headset. I was hooked! I wanted more. I wanted to move around in my world. And that was a little trickier.

I was a beginner to Unity and programming. I had no idea what I was doing. I tried tutorial after tutorial. Usually, I’d get stuck along the way because it didn’t work for me the way the tutorials did.

Then I learned about SteamVR and I got excited. It took awhile to figure out how to put the camera in the scene and get it working, nominally. But I was very excited.

Another tutorial show me that all I needed all along was to drop the “Player” into the scene (and also the “Teleportation” element). Wow, it worked! Now in order to teleport, all I had to do was add a teleport point to any place I wanted to go. Or to put down a teleport plane onto surfaces I wanted to walk across.

But after awhile, it got tedious. I’d put down a path of teleport points and they wouldn’t be close enough together. I had to fuss with them.

Then my co-conspirator Carolyn called and said forget SteamVR. Download VRTK. And I was like “Oh no, not *another* system. I just got SteamVR figured out!” So, I downloaded it and watch maybe one or two tutorials on how to build the VRTK SDK’s and *boom* I was off and running.

VRTK

GETTING STARTED WITH STEAMVR

Steps you through how to set up the SDK for SteamVR using VRTK.

VRTK Website:

https://vrtoolkit.readme.io/docs/getting-started

No need to put down those teleport points or teleport planes. I could go anywhere! It was a sudden freedom of movement.

So friendly. So easy. I think I was in love.

And other interactions were easy, like climbing. (I went a little crazy with climbing). There was even a tutorial to convert that first person shooter project. Nice. All I had to do was find a bunch of useful monsters and substitute them for the ones in the original, build a world and implement it all over again. (Okay, not super easy, but I did it).

CONVERT THE SURVIVAL SHOOTER TUTORIAL TO VRTK

I went through all the sample scenes, of which there are many, and found a ton of useful methods that gave me a lot of control over the interactions with the environment. You can create a gun holster, ziplines, throw things, use a sword! Lots more!

STILL USING STEAMVR?

So, if it’s so great, why did I keep one scene in my game with SteamVR instead of VRTK?

Well, it was the bow.

I loved the SteamVR bow; it’s awesome! (You know, the one from the Lab?) Also, early on, I’d done a tutorial where I learned to make it spawn on the player’s back and return there. Pretty cool.

Try as we might, we just couldn’t get the VRTK bow to work in a way we liked. We called it the “Sausage bow” because in the tutorial, it was made of little links. So, in the Skyway scene, we kept SteamVR instead of VRTK. Still need to sort out a decent bow to use in VRTK. (Email me if you know how).

Here’s Eddie Balderas‘s tutorial on setting up the SteamVR bow to spawn on the player’s back.

NO MORE VRTK? OR IS THERE?

Then I heard the sad news that the developer, thestonefox  (https://github.com/thestonefox/VRTK) was no longer developing it and I felt a little crushed. Still, he was maintaining the SDKs, so I kept using them, hoping to get through with the game before it became obsolete.

But then I heard the good news: VRTK and theStoneFox is back in business! Apparently funded by Oculus. Yay! Good news. I wasn’t keen to learn a whole new system, though I suppose in the ever-changing world of VR, it’s inevitable at some point.

Just not today.