提交 7d1a4215 编写于 作者: M Mr.doob

Fixed 3dof webvr examples.

上级 6b9690cb
......@@ -34,26 +34,6 @@ THREE.GearVRController = function () {
}
this.setHand = function ( hand = 'right' ) {
var handPos;
if ( hand === 'right' ) {
handPos = 0.3;
} else {
handPos = - 0.3;
}
this.translateX( handPos );
this.translateY( - 0.35 );
this.translateZ( - 0.4 );
};
this.getGamepad = function () {
return gamepad;
......@@ -140,6 +120,12 @@ THREE.GearVRController = function () {
};
this.setHand = function () {
console.warn( 'THREE.GearVRController: setHand() has been removed.' );
};
};
THREE.GearVRController.prototype = Object.create( THREE.Object3D.prototype );
......
......@@ -75,6 +75,7 @@
new THREE.BoxGeometry( 6, 6, 6, 8, 8, 8 ),
new THREE.MeshBasicMaterial( { color: 0x404040, wireframe: true } )
);
room.position.y = 3;
scene.add( room );
scene.add( new THREE.HemisphereLight( 0x606060, 0x404040 ) );
......
......@@ -68,6 +68,7 @@
new THREE.BoxGeometry( 6, 6, 6, 8, 8, 8 ),
new THREE.MeshBasicMaterial( { color: 0x808080, wireframe: true } )
);
room.position.y = 3;
scene.add( room );
scene.add( new THREE.HemisphereLight( 0x606060, 0x404040 ) );
......@@ -122,7 +123,7 @@
//
controller = new THREE.DaydreamController();
controller.position.set( 0.25, - 0.5, 0 );
controller.position.set( 0.3, 0.75, 0 );
scene.add( controller );
//
......
......@@ -59,12 +59,6 @@
scene.background = new THREE.Color( 0x505050 );
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 );
camBox = new THREE.Object3D();
camBox.position.y = 1.8;
camBox.add( camera );
scene.add( camBox );
room = new THREE.Mesh(
new THREE.BoxGeometry( 6, 6, 6, 8, 8, 8 ),
......@@ -118,9 +112,8 @@
document.body.appendChild( WEBVR.createButton( renderer ) );
controller = new THREE.GearVRController();
camBox.position.y = 1.8;
controller.setHand( 'right' );
camBox.add( controller );
controller.position.set( 0.25, 0.75, 0 );
scene.add( controller );
var skyBox = {
front: 'textures/cube/Bridge2/posz.jpg',
......
......@@ -36,6 +36,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.vr.enabled = true;
renderer.vr.userHeight = 0; // TOFIX
document.body.appendChild( renderer.domElement );
document.body.appendChild( WEBVR.createButton( renderer ) );
......
......@@ -33,6 +33,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.vr.enabled = true;
renderer.vr.userHeight = 0; // TOFIX
document.body.appendChild( renderer.domElement );
document.body.appendChild( WEBVR.createButton( renderer ) );
......
......@@ -41,12 +41,7 @@
scene = new THREE.Scene();
scene.background = background;
var user = new THREE.Group();
user.position.set( 0, 0.75, 0 );
scene.add( user );
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 );
user.add( camera );
var geometry = new THREE.TorusKnotGeometry( 0.4, 0.15, 150, 20 );
var material = new THREE.MeshStandardMaterial( { roughness: 0.01, metalness: 0.2, envMap: background } );
......@@ -159,7 +154,7 @@
function render() {
var time = performance.now() * 0.0002;
var mesh = scene.children[ 1 ];
var mesh = scene.children[ 0 ];
mesh.rotation.x = time * 2;
mesh.rotation.y = time * 5;
......
......@@ -141,6 +141,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.vr.enabled = true;
renderer.vr.userHeight = 0; // TOFIX
container.appendChild( renderer.domElement );
document.body.appendChild( WEBVR.createButton( renderer ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册