4
« on: January 14, 2015, 11:21:10 pm »
I'm building a 360 camera in a 3d world. Now the gyroscope is updating the camera, so it's like an AR kind of camera.
Now I want to set an offset on the x and y axis. When I start the 3d world in landscape. For example left and right is working.
But when I rotate the device to portrait, x and y should be reversed. But reproject2D3D is still giving me the same results.
So now to scroll left and right, you need to scroll up and down (makes sense?)
Seems like unproject/reproject is not working for me here.
SimpleVector startLocation = new SimpleVector(Interact2D.reproject2D3D(world.getCamera(), fb, (int)mPreviousX2, (int) mPreviousY2)).normalize();
SimpleVector currentLocation = new SimpleVector(Interact2D.reproject2D3D(world.getCamera(), fb, (int) me.getX(), (int) me.getY())).normalize();
double alpha = Math.acos(currentLocation.y) - Math.acos(startLocation.y);
double beta = Math.atan2(currentLocation.z, currentLocation.x) - Math.atan2(startLocation.z, startLocation.x);
double tRotX = rotX - MathUtil.toDegrees((float)beta);
rotX = tRotX%360;
PS I've got this working in iOS, so should be good.