Rotating an object based on accelerometer

I am trying to rotate an object (in this case a box) so that it is always facing towards the top of the device. I created a simple function that calculates this angle based on xGravity and yGravity and am assigning the result to box.rotation. The problem is, the box slowly rotates to the correct position and lags behind the hardware. Even after I have stopped tilting the device the box will continue rotating until it catches up. The only exception is when xGravity changes from positive to negative or vice-versa. Then the box instantly jumps to the proper place, which, while unplanned, is actually the output I am looking for all of the time… not just when xGravity changes its sign. I assume that this has something to do with how the accelerometer is processed. Does anyone have any ideas how I can ge the results I expect? Is there some way to get the accelerometer to notice quick movements without requiring xGravity to change to positive or negative? Thanks in advance. [import]uid: 16410 topic_id: 5553 reply_id: 305553[/import]