{"id":18744596,"url":"https://github.com/dougreeder/aframe-look-controls-z","last_synced_at":"2026-02-23T08:03:57.712Z","repository":{"id":57174209,"uuid":"151601611","full_name":"DougReeder/aframe-look-controls-z","owner":"DougReeder","description":"Drop-in replacement for A-Frame core look-controls. In magic-window mode, the virtual horizon stays parallel to the real horizon.","archived":false,"fork":false,"pushed_at":"2019-05-26T03:39:02.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T17:39:52.400Z","etag":null,"topics":["aframe-component","aframe-vr","aframevr","controls","vr","webvr"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DougReeder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-04T16:21:47.000Z","updated_at":"2024-03-18T03:07:19.000Z","dependencies_parsed_at":"2022-09-02T12:11:25.643Z","dependency_job_id":null,"html_url":"https://github.com/DougReeder/aframe-look-controls-z","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougReeder%2Faframe-look-controls-z","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougReeder%2Faframe-look-controls-z/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougReeder%2Faframe-look-controls-z/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DougReeder%2Faframe-look-controls-z/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DougReeder","download_url":"https://codeload.github.com/DougReeder/aframe-look-controls-z/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239627253,"owners_count":19670844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aframe-component","aframe-vr","aframevr","controls","vr","webvr"],"created_at":"2024-11-07T16:15:22.948Z","updated_at":"2025-10-25T15:09:34.694Z","avatar_url":"https://github.com/DougReeder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"aframe-look-controls-z\n===\n\nAn [A-Frame](https://aframe.io) [WebVR](https://webvr.info/) component.\nDrop-in replacement for core look-controls, except in magic-window mode, the virtual horizon stays parallel to the real horizon.\n(Rotation around the z-axis is tracked, like the x- and y-axes.)\n\nUseful when flying, as in [Elfland Glider](https://elfland-glider.surge.sh/)\n\n[live example scene](https://dougreeder.github.io/aframe-look-controls-z/example.html)\n\n\nYou may also want to [lock the screen orientation](https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation),\nwhich usually requires first going to [fullscreen mode](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).\n\nBasic Usage\n---\n```html\n\u003cscript src=\"https://unpkg.com/aframe-look-controls-z@^2.0.0/look-controls-z.js\"\u003e\u003c/script\u003e\n\n\u003ca-entity position=\"0 1.6 0\" camera look-controls-z\u003e\u003c/a-entity\u003e\n```\n\nScreen Orientation Lock and Fullscreen Mode\n---\nCall goFullscreenLandscape() on a user gesture, such as a mouse click:\n```javascript\nfunction goFullscreenLandscape() {\n    if (!isMagicWindow()) {return;}\n\n    let canvasEl = document.querySelector('canvas.a-canvas');\n    let requestFullscreen =\n        canvasEl.requestFullscreen ||\n        canvasEl.webkitRequestFullscreen ||\n        canvasEl.mozRequestFullScreen ||  // The capitalized `S` is not a typo.\n        canvasEl.msRequestFullscreen;\n    let promise;\n    if (requestFullscreen) {\n        promise = requestFullscreen.apply(canvasEl);\n    }\n    if (!(promise \u0026\u0026 promise.then)) {\n        promise = Promise.resolve();\n    }\n    promise.then(lockLandscapeOrientation, lockLandscapeOrientation);\n}\n\nfunction lockLandscapeOrientation() {\n    if (screen.orientation \u0026\u0026 screen.orientation.lock) {\n        screen.orientation.lock(\"landscape\").then(response =\u003e {\n            console.log(\"screen orientation locked:\", response);\n        }).catch(err =\u003e {\n            console.warn(\"screen orientation didn't lock:\", err);\n        });\n    }\n}\n\n\nfunction isMagicWindow() {\n    return AFRAME.utils.device.isMobile () \u0026\u0026\n        ! AFRAME.utils.device.isGearVR() \u0026\u0026\n        // ! AFRAME.utils.device.isOculusGo() \u0026\u0026\n        ! AFRAME.scenes[0].is(\"vr-mode\")\n}\n```\n\n\nProperties\n---\n\nSee [look-controls documentation](https://aframe.io/docs/0.8.0/components/look-controls.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougreeder%2Faframe-look-controls-z","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdougreeder%2Faframe-look-controls-z","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougreeder%2Faframe-look-controls-z/lists"}