pritom057 - is that my code your using? What variables did you feed into RTmp, I, grav and mag?
In the end I solved my problem with the following code;
switch (s_ev.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
System.arraycopy(s_ev.values, 0, mGravs, 0, 3);
break;
case Sensor.TYPE_MAGNETIC_FIELD:
System.arraycopy(s_ev.values, 0, mGeoMags, 0, 3);
break;
default:
return;
}
if (SensorManager.getRotationMatrix(mRotationM, null, mGravs, mGeoMags)){
// Rotate to the camera's line of view (Y axis along the camera's axis)
SensorManager.remapCoordinateSystem(mRotationM, SensorManager.AXIS_X, SensorManager.AXIS_Z, mRemapedRotationM);
SensorManager.getOrientation(mRemapedRotationM, mOrientation);
SimpleVector cameraVector = new SimpleVector();
cameraVector.x = mOrientation[1];
cameraVector.y = mOrientation[2];
cameraVector.z = mOrientation[0];
myworld.setCameraOrientation(cameraVector);
}
setCameraOrientation() leads too;
public void setCameraOrientation(SimpleVector xyzAngles)
{
Camera worldcam = world.getCamera();
worldcam.getBack().setIdentity();
float Z = xyzAngles.z;
float Y = xyzAngles.y;
float X = xyzAngles.x;
worldcam.rotateCameraAxis(new SimpleVector(0,1,0), -Z);
worldcam.rotateCameraAxis(new SimpleVector(1,0,0), X);
worldcam.rotateCameraAxis(new SimpleVector(0,0,1), -Y);
}
I still think the setBack() method should be possible, and quicker too, but this way at least works.