How to use the VRControls function from three

Find comprehensive JavaScript three.VRControls code examples handpicked from public code repositorys.

38
39
40
41
42
43
44
45
46
47
// Apply VR headset positional data to camera.
orbitcontrols = new keycontrols.VRKeyControls(camera);    

// Store the position of the VR HMD in a dummy camera to allow for panning and junk
fakeCamera = new three.Object3D();
vrControls = new three.VRControls(fakeCamera);
// Apply VR stereo rendering to renderer.
effect = new three.VREffect(renderer);
effect.setSize(window.innerWidth, window.innerHeight);
// Create a VR manager helper to enter and exit VR mode.
fork icon1
star icon3
watch icon5

+ 9 other calls in file

198
199
200
201
202
203
204
205
206
207


function startVRControls() {

  controlMode = 'VR';
  controls = new THREE.VRControls(threeEnv.camera);

  innerObject.add(threeEnv.camera);

}
fork icon0
star icon4
watch icon2

65
66
67
68
69
70
71
72
73
74

    }
}

enterVR() {
    this.controls = new THREE.VRControls(this.renderer.camera);
    this.controls.standing = true;

    this.renderer.effect.requestPresent();
    this.enterButton.classList.remove('show');
fork icon0
star icon1
watch icon1

20
21
22
23
24
25
26
27
28
29
30
// TODO: Eventually include these only if they are needed by a component.
require('three/examples/js/loaders/OBJLoader');  // THREE.OBJLoader
require('three/examples/js/loaders/MTLLoader');  // THREE.MTLLoader
require('three/examples/js/BlendCharacter');  // THREE.BlendCharacter
require('three/examples/js/loaders/ColladaLoader');  // THREE.ColladaLoader
require('../../vendor/VRControls');  // THREE.VRControls
require('../../vendor/VREffect');  // THREE.VREffect


THREE.ColladaLoader.prototype.crossOrigin = 'anonymous';
THREE.MTLLoader.prototype.crossOrigin = 'anonymous';
fork icon0
star icon0
watch icon0

+ 7 other calls in file

19
20
21
22
23
24
25
26
27
28
29


// TODO: Eventually include these only if they are needed by a component.
require('../../node_modules/three/examples/js/loaders/OBJLoader');  // THREE.OBJLoader
require('../../node_modules/three/examples/js/loaders/MTLLoader');  // THREE.MTLLoader
require('../../node_modules/three/examples/js/loaders/ColladaLoader');  // THREE.ColladaLoader
require('../../node_modules/three/examples/js/controls/VRControls');  // THREE.VRControls
require('../../node_modules/three/examples/js/effects/VREffect');  // THREE.VREffect


module.exports = THREE;
fork icon0
star icon0
watch icon0

+ 3 other calls in file

39
40
41
42
43
44
45
46
47
48
renderer.setSize(window.innerWidth, window.innerHeight);

// Round down fractional DPR values for better performance.
renderer.setPixelRatio(Math.max(1, Math.floor(window.devicePixelRatio)));

var controls = new THREE.VRControls(camera);
var effect = new THREE.VREffect(renderer);
effect.setSize(window.innerWidth, window.innerHeight);

this.minFocalLength = 3;
fork icon0
star icon0
watch icon0

95
96
97
98
99
100
101
102
103
104
scene.add(refractSphere)

// VRControls is a utility from three.js that applies the device's
// orientation/position to the perspective camera, keeping our
// real world and virtual world in sync.
vrControls = new THREE.VRControls(camera)

// Create the cube geometry that we'll copy and place in the
// scene when the user clicks the screen
var geometry = new THREE.BoxGeometry( 0.05, 0.05, 0.05 )
fork icon0
star icon0
watch icon1

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)