Thursday, October 29, 2015

Day 67: Keep Your Eye (And Fingernail) On the Ball

Today was a day to dip into using the accelerometer. The way that Unity handles accelerometer input is accessing its acceleration (positive x is right, positive y is up, etc), so one can apply this to an object in the scene, say a ball bouncing around.

The small issue with this is keeping the ball relative; if the ball accelerates purely based off of a initial position where the device is laid flat on a surface, it would severely limit its use. Solution? Relative acceleration. Save the starting accleration and use it as an offset.

I was also worried during remote debugging on my iPhone device; when setting the screen orientation, the screen would rotate no matter what. Thankfully, after testing an Android build, no problems occurred.

What next? Try something like attaching a shmup player with accelerometer input. I like the idea.

No comments:

Post a Comment