better camera rotation algorithm