package a3test.z_axis;

import jp.sourceforge.acerola3d.A23;
import jp.sourceforge.acerola3d.a3.*;
//import javax.vecmath.*;

//Z軸が上の座標系でオートコントロールが上手くいくかどうかのテスト
public class A3Auto2 {
    public static void main(String args[]) throws Exception {
        A23.setDefaultUpperDirection(A3Object.UpperDirection.Z);
        A3Window w = new A3Window(300,300);

        Action3D a3 = Action3D.load("x-res:///vesma9.a3");
        a3.setEnableBehavior(true);
        a3.setAutoDirectionControl(true);
        a3.setAutoActionControl(true);
        a3.setHaltAction("default");
        a3.setWalkAction("walk");
        a3.setRunAction("run");
        a3.setMinWalkSpeed(0.01);
        a3.setMinRunSpeed(1.1);
        //a3.setUpperVector(new Vector3d(0.0,0.0,-1.0));
        //a3.setUpperVector(new Vector3d(1.0,0.0,0.0));
        w.add(a3);
        w.setCameraLocImmediately(0.0,-5.0,0.0);
        double theta=0.0;
        while (true) {
            try{Thread.sleep(100);}catch(Exception e){;}
            a3.setLoc(Math.cos(theta),Math.sin(theta),Math.sin(theta));
            //a3.setLoc(Math.cos(theta),Math.sin(theta),0.0);
            theta = theta + 0.1;
        }
    }
}
