Steve Exploring Stuff: July 2010

2010-07-13

Port of Navigation System to C#/Unity3D

Over the last month or so I've taken a road trip, gone camping, and had a visit from out-of-town family.  I've also been preparing for my next project: Locomotion.  As I mentioned a couple of posts ago, I want to learn C++.  While I became comfortable reading C++ during the NMGen project, it is now time to do some coding in the language.  This means leaving behind Java and the Java based 3D engine I've been using.  I've settled on the Unity3D engine.  Some of the reasons include:

  • It's vast depth of built-in, very well documented functionality will make it a great, fast 3D prototyping environment.
  • There is nothing in its license that stops me from posting my own code as open source.
  • It has a free version, so others can still experiment with my code at no cost.
  • It has an easy to deploy web player, so I can move past static examples. (As you will see shortly.)
There are some drawbacks:
  • The engine is closed.  No calling into the guts from my own code.  I doubt that is going to be a problem for a long while.
  • In in order to keep things free for other's, I'll have to make sure that all my C++ code can be compiled as a .NET assembly.
I expect that last drawback will be the biggest pain.  But the overall benefits of using Unity3D are likely to outweigh the drawbacks.

Now for the code related stuff.  To get things up and running I've ported my Java navigation system prototype to C# for Unity3D.  The "for Unity3D" part is due to the fact that I switched to using the Unity3D Vector classes.  I'm not sure that is the best decision since it ties the code to the engine.  But it isn't a costly decision.  With only a day or two of work I can easily switch back to my own Vector classes.  

Here is the code, the project home, and, goody, a web demo.  The web demo requires the Unity3D player.

There is also a bug fix for anyone who downloaded the Java version.  If you are still using it, make sure to pull down the update.

Enjoy the new code and keep the puppy out of the cactus patch.  (Silly dog.)