Explorar el Código

Merge pull request #5527 from pehrlich/vrcontrols-posotion

Add position tracking to VRControls
Mr.doob hace 10 años
padre
commit
5ec4b1e561
Se han modificado 1 ficheros con 9 adiciones y 3 borrados
  1. 9 3
      examples/js/controls/VRControls.js

+ 9 - 3
examples/js/controls/VRControls.js

@@ -44,11 +44,17 @@ THREE.VRControls = function ( object, callback ) {
 
 		if ( vrInput === undefined ) return;
 
-		var orientation = vrInput.getState().orientation;
+		var state = vrInput.getState();
 
-		if ( orientation !== null ) {
+		if ( state.orientation !== null ) {
 
-			object.quaternion.set( orientation.x, orientation.y, orientation.z, orientation.w );
+			object.quaternion.copy( state.orientation );
+
+		}
+
+		if ( state.position !== null ) {
+
+			object.position.copy( state.position );
 
 		}