camera problems
hallo.
i got problems to fix my camera-math.
i intended to assign the camera direction to the direction-vec of vehicle.
n[0] = 0; n[1]=-1; n[2]=0; //origin dir of vehicle
double dir[] = new double[3];
OM.transform(n,dir); //translated to current orientation matrix
double ax = -dir[1]; //rotation axis
double ay = dir[0];
double az = 0;
double angle = Math.acos(dir[2]);
Matrix3D Q = new Matrix3D(); //calculate a quaternion
double w, x,y,z;
w = Math.cos(angle/2);
x = ax*Math.sin(-angle/2);
y = ay*Math.sin(-angle/2);
z = 0;
Q.quaternion(w, x,y,z);
camera.OM.setTransformation(Q); //setup camera matrix
can someone help me?
thanks.
unwritten letters
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement