Mouse3Dではちゅねミクを動かそう。
1.カメラ回転
カメラの位置を回して、ステージ全体がくるくる回ってるように見える方法。今後も使えそうなのでメモっとく。
でも多分基本技。
まず初期化部分。
cameraRotation = 270;
camera.y = 1000;
camera.z = -1000 * Math.sqrt(3);
camera.focus = 180;
camera.zoom = 4;
this.addEventListener(Event.ENTER_FRAME , rotateCamera);
camera.y = 1000;
camera.z = -1000 * Math.sqrt(3);
camera.focus = 180;
camera.zoom = 4;
this.addEventListener(Event.ENTER_FRAME , rotateCamera);
で、カメラを回す関数
private function rotateCamera(e:Event):void {
cameraRotation += 1.2;
camera.z = 1000 * Math.sin(cameraRotation * Math.PI/180);
camera.x = 1000 * Math.cos(cameraRotation * Math.PI/180);
}
cameraRotation += 1.2;
camera.z = 1000 * Math.sin(cameraRotation * Math.PI/180);
camera.x = 1000 * Math.cos(cameraRotation * Math.PI/180);
}
カテゴリ:ActionScript | Papervision3D



