Bang The Chains!
I’ve uploaded the final submission of VR Discs Of Golf to the Leap Motion 3D Jam. It’s probably not super applicable to you if you don’t have an Oculus Rift and Leap Motion controller, but I’ll be adding gamepad controls, Cardboard, and non-VR support after the 3D Jam so that everyone can play it.
You can download it and vote for it here: VR Discs Of Golf submission page
It was a pretty fun project, and I learned quite a bit from it. Plus, I got to write some custom physics code for the discs. I’ll go ahead and dump whatever I can remember right now into this post for posterity.
When I first heard about this 3D Jam just over a month ago, I was told that anybody who submitted a project would receive the Leap Motion controller for free. If I only consider the $80 cost, then I easily made less than 69¢ an hour. Of course, having a playable game is a much bigger payoff than the hardware.
I had decided to make a disc golf game while I was reading about the hardware, since I know a bunch of avid disc golfers and hadn’t really seen many disc golf games before. Unfortunately, after I received the controller I realized that the hand positions for disc golf are pretty much the worst they can be for motion tracking. So, the controls are a bit simplified for now.
Custom Physics Code
This was easily the highlight of the project. I haven’t written custom physics code in several years and it was great to get back to it. I read quite a few papers about disc physics and pulled together the parts that were sensible. Being the internet, there are a bunch of people who like to talk a lot about things that they don’t actually understand. Ultimately, I found myself taking much of my model from a few research papers, which I came across in various articles.
I prioritized the various aspects of the physics model and focused on the lift/drag model and gyroscopic precession first, since they have the most influence and were the easiest to test. Due to the time limit, I didn’t get to the more subtle aspects; spin decay, instability, magnus force, variable moment of pressure, etc. The game feels pretty good though, so I’m happy with what I got in for the 3D Jam.
The Leap Motion controller is a small box with 2 IR cameras in it that can track hand positions within a couple feet. When mounted on the front of the Oculus Rift, it can track your hands as you move them around in front of your face. Due to the angle that the cameras are facing, when you have your hands pointed away from you and closed it presents a very small image to process. Unfortunately, that’s the primary position for throwing a disc.
So, I’m still not entirely sure that the controller can’t detect disc throwing movements very well. I think that a major factor with the tracking issues I had is my old computer hitting its limits. I’m already researching new components to build a new machine soon.
In any case, since I needed the game to work on my machine, I simplified the controls to that you hold your hand(s) in positions that are very easy to identify for the controller. The controller seemed to do a very good job at recognizing when you open and close your hands, so I based most of the interface on opening and closing your hands to trigger actions, while using movement and rotation to fine tune the input.
I had a friend try it out earlier today and watched as he struggled to make it do what he wanted. Since I had to finish the game by midnight tonight, I was a little bummed. However, I tried a minor modification that turned out to work and the game is much better now. I basically separated the aiming and throwing phases of input which made each of them more robust. Phew!
Pre-release Means It’s Broken Somewhere
This no longer surprises me, but it still wastes my time. I never did update to the latest version of Oculus and Unity for the game, which I really wanted to do. The main reason is that I haven’t been able to get the latest version of the Oculus runtime working on my computer yet. I’m sure I’ll figure it out soon, but I didn’t want to waste time with it when the game worked with older versions. I doubt it would have made much of a difference, but I still don’t like feeling like there isn’t time to upgrade everything and take advantage of any bug fixes and optimizations.
VR Meteors Update
I’ve also done a little bit more work on VR Meteors this past month and am planning to upload the Oculus version to the share site soon. I’ve come across a few issues with the Android version that I’ll need to fix before I release a Cardboard build. I suspect that this will progress much faster now that the 3D Jam is done.