TOP

その他
Game Development Diary
Undead Syndrome 開発メモ
日々コレどうしよう2016年以降版



ブラウザゲーム
発火少年の地面焦がし
MAGICAL METEOR SHOWER

メタセコイア備忘録
東日本大震災(Aftermath of the 2011 Tohoku earthquake and tsunami)

ムカゴソフトウェア開発
e-mail:cqp00202@nifty.ne.jp

 X軸回転(ピッチ)
 Matrix.CreateRotationX(Single)メソッド
public static Matrix CreateRotationX (
    float radians  //角度をラジアンで渡す
)
Matrix mat = Matrix.CreateRotationX(MathHelper.ToRadians(30f));
float r = (float)Math.Atan2(mat.M23, mat.M22);
//■スプライトフォントで描画
//  ラジアン→角度へ
spriteBatch.DrawString(font
                     , MathHelper.ToDegrees(r).ToString()
                     , new Vector2(100f, 100f)
                     , new Color(Color.White.ToVector4()));

 実行結果
アークタンジェントの詳細については……逆三角関数
 Y軸回転(ヨー)
 Matrix.CreateRotationY(Single)メソッド
public static Matrix CreateRotationY (
    float radians  //角度をラジアンで渡す
)
Matrix mat = Matrix.CreateRotationY(MathHelper.ToRadians(30f));
float r = (float)Math.Atan2(mat.M31, mat.M33);
//■スプライトフォントで描画
//  ラジアン→角度へ
spriteBatch.DrawString(font
                     , MathHelper.ToDegrees(r).ToString()
                     , new Vector2(100f, 100f)
                     , new Color(Color.White.ToVector4()));

 実行結果
アークタンジェントの詳細については……逆三角関数
 Z軸回転(ロール)
 Matrix.CreateRotationZ(Single)メソッド
public static Matrix CreateRotationZ (
    float radians  //角度をラジアンで渡す
)
Matrix mat = Matrix.CreateRotationZ(MathHelper.ToRadians(30f));
float r = (float)Math.Atan2(mat.M12, mat.M11);
//■スプライトフォントで描画
//  ラジアン→角度へ
spriteBatch.DrawString(font
                     , MathHelper.ToDegrees(r).ToString()
                     , new Vector2(100f, 100f)
                     , new Color(Color.White.ToVector4()));

 実行結果
アークタンジェントの詳細については……逆三角関数


