This week I’m working hard on putting together a Kickstarter campaign so I haven’t had much time to work on gameplay. But I wanted to show off an exciting development this week: Head-tracking.
Remember the video below from a few years back? In it, Johnny Lee showed off his awesome head tracking demo for games using a Wiimote connected to his PC. It turns a monitor or TV into a portal into a virtual room that visually reacts to movement exactly as viewing a real 3D box through a window would. Objects can even be seen to float out in front of the screen, providing a real 3D experience without the need for an expensive 3D monitor. In fact, all you need to pull this off is a Wiimote and a cheap pair of safety glasses with infra red LEDs in them.
I’ve always wanted to implement this in a game, but as I don’t have much of a grounding in Matrix mathematics I struggled with the code and usually gave up. This week I buried myself in code for a full solid day and finally managed to do it. It involved a lot of trial and error, and manually flipping values in the projection matrix, but the final version produces 100% mathematically and visually identical results to Johnny Lee’s version. Below is a gallery of a few screenshots using identical inputs for Johnny’s version and mine. The position of the ships and targets is random, but notice that the lines match up perfectly because the perspective is identical.
I plan to have this feature in the final game, hopefully for space combat but definitely for the ship designer. Imagine plugging ship pieces together like lego to design your own ship and being able to look around it in true 3D as you’re doing it. That would be awesome. I’ll upload a video of the head tracking in action once I get more batteries for my Wiimote.