Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How can i calculate angle based on movement in C# XNA when i'm moving object with accelerometer? If object is moving up, sprite would rotate in corresponding direction. Should i use two vector coordinates(old, new) to calculate angle using Atan2?

share|improve this question

1 Answer 1

Short answer: Yes.

Slightly longer answer: Maybe you want to add the accelerometer input to the objects velocity variable, so that there are no very sudden movement changes, when the accelerometer fluctuates. Then you would use the current velocity to calculate the objects angle (still using atan2).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.