Friday, October 30, 2015

Day 68: Metal Gear Launches Static

Today was where the challenge started in mobile device input. The way that the accelerometer reads input in Unity is similar to that of a gyroscope, except with magnitude. Since I needed to work with a variable speed, I figured I'd normalize the values and work with that as a rate to apply acceleration to the model in question I'm working on (a shameless copy of Metal Gear Rex).

The idea is to take a scrolling shooter and vary its controls by way of the accelerometer, rather than by specific touch controlled input. This is a bit of a step back from the precise control people are looking for, but may provide a unique experience. The model is viewed from a tipped angle, and accelerates up, down, left, and right.

There was a bit of an issue, however; the way that this acceleration input works, the values were only zero at a completely flat-laying phone; this required a relative initial offset, which also had to be normalized and applied against the current acceleration. That way, an initial position could be wherever the phone is when the application begins.

Afterwards, I applied the static sprite as a billboard for firing bullets. The problem? Oddly enough, Transform.LookAt applied to these sprites cause them to look backwards. I found no other solution than had them look the other way via the transform.position - Camera.main.transform.position switcheroo for a target. And behold! An accelerometer controlled Metal Gear that launches balls of static!


Hopefully I won't run out of prototyping ideas until the big day on Tuesday.

No comments:

Post a Comment