Skip to content

Commit

Permalink
KJSL: Reviving DeviceOrientationControls for iPhone
Browse files Browse the repository at this point in the history
  • Loading branch information
kevleyski committed Jul 30, 2024
1 parent a3f9fa3 commit 678513f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void main() {
}

// WebXR has animation loop but if that's not available we simulate that instead
if (this.webVREffect) {
if (this.webVREffect && this.webVREffect.isPresenting) {
this.webVREffect.render(this.scene, this.camera);
}

Expand Down Expand Up @@ -651,6 +651,15 @@ void main() {
this.animationFrameId_ = this.requestAnimationFrame(this.animate_);
if (this.orbitcontrols.update()) {
this.renderer.render(this.scene, this.camera);
if (this.webVREffect) {
this.webVREffect.isPresenting = false;
}
} else if (this.webVREffect) {
// this.controls3d.orbit.target.setX(this.camera.quaternion.x);
// this.controls3d.orbit.target.setY(this.camera.quaternion.y);
// this.controls3d.orbit.target.setZ(this.camera.quaternion.z);
this.controls3d.orbit.update();
this.webVREffect.isPresenting = true;
}
}

Expand Down
1 change: 0 additions & 1 deletion vendor/three/DeviceOrientationControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class DeviceOrientationControls extends EventDispatcher {
const onDeviceOrientationChangeEvent = function (event) {

scope.deviceOrientation = event;

};

const onScreenOrientationChangeEvent = function () {
Expand Down

0 comments on commit 678513f

Please sign in to comment.