For Moonbase: Lander I needed a way to calibrate the starting or neutral position of the device in a manner that could be stored and re-used during game play.
I looked on the Unity3D forums, and found this thread:
… where Sandoze, from Fuel Games posted their solution.
I converted this from C# to Unity.js, and later modified it with the help of Neil Carter (NCarter) on the #unity3d irc channel.
And this is what I finally came up with: