Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
XNA Windows Phone ゲームがあり、加速度計でスプライトを動かします
私の問題は、スプライトを移動方向に向ける方法がわからないことです。これまでのところ、これは私のコードです:
arrowPos.Y += -accelState.X*10; arrowPos.X += -accelState.Y*10; rotation = -(float)Math.Atan2(arrowPos.Y, arrowPos.X);
現在のrotation計算では、スプライトの現在の位置が使用されます。スプライトは、北または西に移動しているかどうかに関係なく、その位置にある可能性があります。
rotation
代わりにaccelState.Xとの値を使用してみてください。accelState.Y
accelState.X
accelState.Y