Shaky rotation

Hi guys!

I’m trying to rotate my player using the accelerometer of my phone with this line of code:

myRigidBody.rotation = -Input.acceleration.x * rotationMagnitude; (<-this line of code is inside Update())

where rotationMagnitude is just a constant to increase the Input value.

Actually this works, but the player is also super shaky! How can I achieve a smoother result?

I’ve actually found some threads with some solutions (Mathf.smoothDamp seems to be the right answer) but I don’t really know how to apply them :(.

Can someone please help me using smoothDamp or do you have other solutions? Thank you so much!

Actually you want SmoothDampAngle for this. Start with the example code given in the manual, and see if you can adapt it to your needs.

When you post your code for help, please be sure to enclose it in code tags.

Good luck!