Friday, August 26, 2011

Galactic Core v2.01

  - New Feature: Pref to remove all framerate limiting
  - Update: Better orientation sensor handling
  - Update: Greater star depth

The main reason for this update is to improve the orientation sensor, which had some bad logic going on on my part.  Basically, for 2.0 I switched it over to using the orientation sensor rather than the accelerometer, which is much better for battery life but returns an angle (0-359) rather than a gravity vector.  To smooth out the behavior, I accumulated the values gradually instead of just using the most recent one.  This smoothed things out, but I was still noticing that sometimes it seems like the behavior would be backwards.

I finally realized what it was and got it fixed.  Basically, since we're just using the orientation to modify the X axis of the camera, the range 0-180 is visually the same as 360-180.  360 and 0 being the same is cool and all, except that when you're doing a bunch of averaging 360 isn't the same as 0 at all -- it's dragging your average over towards 180 instead, which is the opposite value.  Obvious in retrospect but I missed this for a while.  The easy fix is that if the incoming value is greater than 180, subtract it from 360 before putting it into the accumulator, then work with that value range.

I also hooked up a checkbox in the settings that will let you uncap the framerate if you'd like.  Normally I'm keeping it low to help the UI stay snappy, but if you've got a Galaxy S or something feel free to let it go wild, it'll be fine.

No comments:

Post a Comment