Tag Archives: Unity

VR Discs Of Golf

VR Discs Of Golf

VR Discs Of Golf Title Screen

I suppose I can go ahead and announce that the project I’m making for the Leap Motion 3D Jam is a VR Disc Golf game. I basically have the disc physics and basket interaction at a playable state, so I’m going to stay committed to the premise. I still don’t know how accurate it really is, since I can’t find any type of recorded flight data online. That’s why I’ll need to bother some of my friends who disc golf to try it out for me.

I’ll be making the course out of geometric shapes and basic grid-style textures. It’ll be a little like Discs Of Tron, so that’s why I’m calling it VR Discs Of Golf. In fact, I’m pretty sure that this is a precursor to a Discs Of Tron remake for VR. I may even add moving obstacles and trick shots, so it’ll be kind of like disc mini-golf.

Unfortunately, I don’t know if the Leap Motion is going to be accurate or fast enough to do a realistic throw motion for the game. It may be that my computer is finally starting to show its age, and can’t quite keep up the with Leap Motion’s processing demands. It may also be that the angle of the hand when making a disc throwing motion is about the most inaccurate angle for the cameras, so that’s my fault for not trying the interface before I wrote the physics code. It’ll still be cool, but it will be more of a gesture-based interface. While I think about the interface and how I’m going to handle it, I’ve gone back to finishing up a release version of VR Meteors.

VR Meteors

VR Meteors Title Screen

VR Meteors keeps getting closer to a release date. I put in the high score and initials screens today. I also added a shield effect when you get hit. Of course, it’s all delightfully programmer art, but it gets the job done.

At this point, I only have a few things left to do. I’ll add a background sound and audio options to the settings. I’m going to implement the single button play style that I had for the Gear VR into the Cardboard build. Now that I have a better understanding of the rendering system, I’ll see about being able to switch between the colored and outline graphics on-the-fly. Then I’ll do a tuning and polish pass and go through the publishing steps for Google Play and the Oculus Share site.

Since publishing a game is a pretty significant step and legitimizes my company, I’m really getting excited about it. I’m pretty nervous too, since this will effectively be my “first impression”. I’m just trying to deliver an enjoyable experience that is quick and easy to play, while not trying to do anything extraneous. I’ll add more stuff in later updates as I get the systems written. At least it’s free, so there shouldn’t be any complaints about the price. It is the internet though, so I won’t be surprised if there are.



Google Cardboard

Google CardboardGoogle Cardboard Viewer

Well, since there seems to be a major upgrade of the Gear VR around the corner, I’ve decided to hold off on getting the hardware until it is released. Plus, various issues with the 0.7 runtime and lack of laptop support makes Oculus a bit of a pain to deal with at the moment.

In the meantime, I’m working on supporting the Google Cardboard platform. While the general concept and functionality are similar to the Oculus, the experience is a bit less immersive. The field of view is more akin to a View-Master, which coincidentally is releasing a Cardboard viewer this fall. I love my View-Master. I’ll definitely be getting one.

View-Master Cardboard Viewer

Google Cardboard in Unity

Using the Cardboard SDK for Unity makes it very easy. You basically just need to attach the StereoController to your existing camera. Make sure the camera has the MainCamera tag. You’ll also need the Cardboard component somewhere in your scene.

I’ve had some inconsistent results with making Android builds and the rendering not working. I’ve made some builds with just the above two components added to the scene and the stereo cameras get created at runtime and render properly. Other times, I’ve had the rendering be black, and it only appears when I turn off the VR mode. In this case, I’ve had to create the stereo cameras in the scene in the editor, so that they exist before making the build. I haven’t tracked down the exact cause of this issue, but it would make it easier to switch between Cardboard and Oculus builds if I didn’t have to create/delete the stereo cameras before each build.

Cardboard Viewer


Teefan Cardboard Viewer

I’ve ordered a plastic viewer from Amazon that has headstraps. It looks pretty adjustable, and as good as any of the other headsets I’ve seen. Plus, it does have the magnet controller for single event input.

Ouya Controller

Ouya Controller

I also ordered a tiny Bluetooth gamepad from Amazon. It looks like a passable controller, but I mainly ordered it to get the free shipping. As it turns out, my Ouya controller connects to Android and works just fine. I do need to work on detecting the control scheme and map the inputs appropriately. Put that on the list.

At this time, I’m planning on getting the games customized and working for Cardboard so that I can publish them to Google Play and iTunes. I figure that will be good to work on while I wait for Oculus to be more reliable.


Unity And Blender Files

Importing Blender Into Unity

Since I’m using Blender and Unity for my current projects, I’ve had to figure out a common problem with this integration.

Right-handed… left-handed… up is forward… forward is up… dogs and cats living together.

There are a bunch of posts about importing models from Blender into Unity, and how they always come in rotated incorrectly. Blender is right-handed with (right, forward, up) orientation, while Unity is left-handed with the (right, up, forward) orientation. The primary axes seem to be forward and up, since the objects rotate around the axis that bisects those two.

Basically, you want your Blender model to face forward along the z-axis and up along the y-axis. This causes your model to appear to be pointing up in the Blender workspace, which is not really how you want to work on things. Blender has the ability to distinguish between applied rotation and displayed rotation, which I use to fix this apparent problem.

After researching and experimenting, I’ve decided to use the following method. However, I have not attempted to animate any of my objects yet, so that may not work properly. If animations, or any other feature, breaks this method in the future, I will update this post to reflect the fix.

Blender Workflow

  • In Blender, create your model upright using (right, forward, up) orientation.
  • Rotate the model (-90, 180, 0) using XYZ Euler rotation.
  • Apply the rotation.
  • Rotate the model (-90, 180, 0) using XYZ Euler rotation.

This will apply the corrective rotation, which fixes the rotation in Unity. Then it uses the second rotation to make the object appear correctly aligned in Blender. It just so happens that the complementary rotations are equal, since it’s effectively rotating the object 180 degrees around the (0,0.7071,0.7071) axis.

You could also rotate the model using (0, 0, 0.7071, 0.7071) in quaternions, or (0, 0.7071, 0.7071, 180) in axis-angle notation. It’s up to you. Generally these are safer, since they don’t suffer from potential gimble-lock, but this rotation works fine in Euler angles.

I’ve found that as I join objects together, they remain properly rotated. I haven’t tried anything too complicated though, like multiple objects or joining to a non-rotated object. I’ll test those situations out soon and update this post with any findings.