This commit is contained in:
“chrisshank” 2024-12-20 13:43:34 -08:00
parent 8c51ca5ede
commit feaa6023b9
1 changed files with 3 additions and 2 deletions

View File

@ -66,15 +66,16 @@ rotation: from.x"
function onDeviceOrientation(e) {
console.log(event);
// ropes.forEach(rope => { rope.gravity = { x: 0, y: 0} })
// ropes.forEach(rope => { rope.gravity = { x: 0, y: 0} })
}
window.enableGravity = async function enableGravity() {
if (DeviceOrientationEvent.requestPermission) {
const permission = await DeviceOrientationEvent.requestPermission();
console.log(permission)
if (permission === "granted") {
window.addEventListener("deviceorientation", onDeviceOrientation);
console.log('registered')
} else {
console.warn('Permission for device orientation rejected', permission)
}