我已经完成了我的问题 ,这是我的解决方案
首先,我需要在onSensorChanged(SensorEvent以使这个3矩阵来获得X,Y的结果,z位置
private float[] mRotXMatrix = new float[] {
1, 0, 0, 0,
0, 0, 1, 0,
0, 1, 0, 0,
0, 0, 0, 1 };
private float[] mRotYMatrix = new float[] {
0, 0, 1, 0,
0, 1, 0, 0,
1, 0, 0, 0,
0, 0, 0, 1 };
private float[] mRotZMatrix = new float[] {
0, 1, 0, 0,
1, 0, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 };
然后E)方法我一起旋转,所有这些3矩阵,这样
Matrix.multiplyMM(mViewMatrix, 0, deltaRotationMatrix, 0, mViewMatrix, 0);
Matrix.multiplyMM(mRotXMatrix, 0, deltaRotationMatrix, 0, mRotXMatrix, 0);
Matrix.multiplyMM(mRotYMatrix, 0, deltaRotationMatrix, 0, mRotYMatrix, 0);
Matrix.multiplyMM(mRotZMatrix, 0, deltaRotationMatrix, 0, mRotZMatrix, 0);
而获得X,Y,我的摄像机视图的Z,只是从这些MATR得到它我的相机视图IX
viewX = mRotXMatrix[2];
viewY = -mRotYMatrix[6]; // +/- up to your initial camera view
viewZ = mRotZMatrix[10];
什么是deltaRotationMatrix为什么会mRotXMatrix是mRotYMatrix不同等等,如果你申请相同的multiplyMM – Burf2000 2013-04-15 14:22:21