Skip to content

Commit

Permalink
feat: motion controls option
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Sep 14, 2018
1 parent f8004e2 commit 49a2bd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Maintenance Status: Stable
- [Accessing THREE.js objects](#accessing-threejs-objects)
- [Options](#options)
- [`forceCardboard`](#forcecardboard)
- [`motionControls`](#motioncontrols)
- [`projection`](#projection)
- [`'360'`, `'Sphere'`, or `'equirectangular'`](#360-sphere-or-equirectangular)
- [`'Cube'` or `'360_CUBE'`](#cube-or-360_cube)
Expand Down Expand Up @@ -184,6 +185,11 @@ player.vr().rendeer;
Force the cardboard button to display on all devices even if we don't think they support it.

### `motionControls`
> Type: `boolean`, default: `true on ios and andriod`
Whether motion/gyro controls should be enabled.

### `projection`

> Type `string`, default: `'auto'`
Expand Down
10 changes: 8 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,17 @@ class VR extends Plugin {

if (!this.controls3d) {
this.log('no HMD found Using Orbit & Orientation Controls');
this.controls3d = new OrbitOrientationContols({
const options = {
camera: this.camera,
canvas: this.renderedCanvas,
orientation: videojs.browser.IS_IOS || videojs.browser.IS_ANDROID || false
});
};

if (this.options_.motionControls === false) {
options.orientation = false;
}

this.controls3d = new OrbitOrientationContols(options);
this.canvasPlayerControls = new CanvasPlayerControls(this.player_, this.renderedCanvas);
}

Expand Down

0 comments on commit 49a2bd1

Please sign in to comment.