投稿者:野中 文雄 | 投稿日:2011.01.22 | [AS 3][ActionScript][Tips][野中ゼミ] 3次元空間のオブジェクトをマウスポインタの位置に応じて回すときの考え方です(図001)。Matrix3Dクラスで座標変換する場合、水平方向と垂直方向それぞれについて回転を加える方法がひとつあります。今回はもうひとつのやり方として、水平・垂直合わせてベクトルの外積により回転軸を求めてみます。 図001■四方に置いた面を上下左右に回す 矩形の画像で四方を囲み、上下左右に回す例は、gihyo.jp連載「ActionScript 3.0で始めるオブジェクト指向スクリプティング」第38回「z座標値に応じて重ね順を変える」で解説しました。Matrix3D.appendRotation()メソッドを用いて、水平と垂直それぞれの回転を加える前者の考え方にしたがっています。このサンプル