In my game, I’m working with the user rotating the device. I discovered an obviously simple, easy, and neat little way to calibrate the device, without really calibrating it. I like to call it “auto-calibrate”. Here’s how it works:
All you have to do is this:
rotation = rotation + RotationRate every frame. That way, when the user pauses the game and repositions himself/herself, he/she doesn’t have to worry about calibrating the game again. If you want to use good programing skills, you could also just calibrate the device when you start the game by just saying something like
startGravity = Gravity at the start of the game and
rotation = Gravity-startGravity when you update.
So there’s my little tip of advice for games with accelerometer use.
Nifty! I haven’t made many games featuring the accelerometer, I probably should try this though
@Luatee - Thanks. I look forward to seeing what you make.