i want rotate libgdx perspective camera device, can put 3d objects on specific points in room , when rotate device perspective camera should same.
i found code in internet:
//update camera rotation //get rotation matrix matrix4 mat4 = new matrix4(); gdx.input.getrotationmatrix(mat4.val); //set new rotation camera.up.set(mat4.val[matrix4.m11], mat4.val[matrix4.m12], mat4.val[matrix4.m10]); camera.direction.set(-mat4.val[matrix4.m21], -mat4.val[matrix4.m22], -mat4.val[matrix4.m20]); camera.update();
andthis seems work portrait mode, use landscape mode. know how rotate matrix correctly ?
hm... use same code, world has y up. not work in portrait mode, in landscape mode.
i'd know how working in portrait mode. of course, best if not matter if hold phone in portrait or landscape mode or in 45° angle. possible ?
Comments
Post a Comment