I’ll never use Algebra or Trigonometry, why do I need to learn it in school?

Lucky for me I enjoyed math in school, so I never asked this question. Up to this point, Unity3D has handled all the reflective forces on a rigid body so I haven’t had to do any calculations like that…THANK GOODNESS. I might like math, but I’m not quite that crazy…yet. During development of Shape Sprout, I realized that I needed to shoot a “shape bullet” from the tip of her wand out to where the player touched the screen. “Oh, that’s easy…I’ll just use Lerp() or MoveTowards()!”, I thought excitedly. That works great…until the shape bullet stopped at the spot the player touched the screen and didn’t continue on like I wanted it to.  *FACEPALM*  Ya, I really should have known that was going to happen, lack of sleep maybe? Now how do I figure that one out? Hmm…I seem to remember something about slope and  y = mx+b in algebra. No, that was slope intercept form…I need just the slope. Thank goodness for Google, there isn’t anyway I can keep all this stuff in my head. So, its y2 – y1/x2 – x1. Easy enough, we know start x and y position (wand tip) and we know end x and y position (where the player touched the screen), we can get slope! Okay great, that works now and the “shape bullet” is following the path like we want it to! Now…how can I make Kari’s arm rotate in line of where the shape bullet is going?  Trigonometry to the rescue! I already extensively use COS in the movement of Jumble’s hot air balloon, I know there is something that would help. Google to the rescue again! ARCTAN…yup, looks like we just feed it the slope and it gives us back what we need. Or so I thought. Something isn’t quite right, her arm is rotating but it is moving at a different speed than what it should really be rotating. That is when I discovered the value you get from ARCTAN is in radians and not degrees *FACEPALM*, why didn’t I know that? Luckily we have a constant we can use called Mathf.Rad2Deg so I don’t have to figure it out. Now just offset the angle slightly since our arm sprite is at about a 45 degree angle and voilà, it works as intended! Only and Indie Dev would get excited about something like this. I’m pretty sure there is probably an easier way Unity lets you do all this and I just don’t know it yet.  But, don’t say you will never use Algebra or Trigonometry.

Unity what??

“So what’s this ‘powered by Unity’ screen I keep seeing when I play your games?”

I’ve never been more excited about game development than after discovering a little tool by the name of Unity3D about 4 months ago…and I use the term “little” very loosely. Why am I so excited about it? It takes a lot of the meticulous initialization and setup you used to have to do through code and handles a lot of it for you so you can focus on the code that handles the content and game play. Back in the days of C++ (am I showing my age now?) to do something like a simple animation, you had to load the sprite sheet, determine the location and size of each frame of the animation on the said sprite sheet, create a mask so the transparent parts of the image would be transparent and create an engine that would cycle through those images smoothly.  Yes, the “BitBlt” function was my friend during those times. That doesn’t even include the collision detection on the sprite itself! This was done ALL through code and was exceptionally tedious. Unity3D gives you the ability to do all of this without writing a single line of code.  Absolutely amazing. You can now focus your code on what your character DOES instead of how to just make your character appear on screen and walk. And that’s just scratching the surface, there is so much more to Unity3D that I haven’t even touched on yet. Oh, did I mention it also has this nifty feature for building your game on multiple devices and platforms fairly easily? How else could we get our games out for Android and iOS so quickly?  I’d really love to put together a 3D game sometime but I’ll have to get more familiar with Blender for that one. “Ummm…weren’t you just talking about Unity3D? What’s ‘Blender’?” I’ll save that one for another time.

So what exactly does Unity3D look like in action? Glad you asked 🙂 One of the powerful features of Unity3D is it allows you to “play” the game during development so you can see what each object is doing and how they are reacting to their surroundings. Debugging on steroids is what I call it. It also REALLY helps to have two monitors. If you are interested in game development, I HIGHLY suggest getting Unity3D and tinkering with it.

Unity3D - Shape Sprout
Unity3D – Shape Sprout