0

変換されたスプライト内の x 座標と y 座標を取得しようとしています。画面の中央で回転する単純な 200x200 スプライトがあります。単純にするために原点が (0,0) です。

スクリーンショット

マウス座標を変換できるが、指定された x または y 値のみを使用するコードを作成しました。

int ox = (int)(MousePos.X - Position.X);
int oy = (int)(MousePos.Y - Position.Y);

Relative.X = (float)((ox - (Math.Sin(Rotation) * Y /* problem here */)) / Math.Cos(Rotation));
Relative.Y = (float)((oy + (Math.Sin(Rotation) * X /* problem here */)) / Math.Cos(Rotation));

どうすればこれを達成できますか?または、どうすれば方程式を修正できますか?

4

1 に答える 1