Skip to content

Commit a8c3ea3

Browse files
committed
Examples: Added OrbitControls to webvr_paint and webvr_sculpt.
1 parent 33a9795 commit a8c3ea3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

examples/webvr_paint.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
<script type="module">
2020

2121
import * as THREE from '../build/three.module.js';
22+
import { OrbitControls } from './jsm/controls/OrbitControls.js';
2223
import { TubePainter } from './jsm/misc/TubePainter.js';
2324
import { WEBVR } from './jsm/vr/WebVR.js';
2425

2526
var container;
2627
var camera, scene, renderer;
2728
var controller1, controller2;
2829

29-
var painter;
30+
var controls, painter;
3031

3132
var up = new THREE.Vector3( 0, 1, 0 );
3233

@@ -44,6 +45,10 @@
4445
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.01, 50 );
4546
camera.position.set( 0, 1.6, 3 );
4647

48+
controls = new OrbitControls( camera, container );
49+
controls.target.set( 0, 1.6, 0 );
50+
controls.update();
51+
4752
var geometry = new THREE.BoxBufferGeometry( 0.5, 0.8, 0.5 );
4853
var material = new THREE.MeshStandardMaterial( {
4954
color: 0x444444,

examples/webvr_sculpt.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
<script type="module">
2020

2121
import * as THREE from '../build/three.module.js';
22-
22+
import { OrbitControls } from './jsm/controls/OrbitControls.js';
2323
import { MarchingCubes } from './jsm/objects/MarchingCubes.js';
2424
import { WEBVR } from './jsm/vr/WebVR.js';
2525

2626
var container;
2727
var camera, scene, renderer;
2828
var controller1, controller2;
2929

30-
var blob;
30+
var controls, blob;
3131

3232
var points = [];
3333

@@ -46,6 +46,10 @@
4646
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.02, 50 );
4747
camera.position.set( 0, 1.6, 3 );
4848

49+
controls = new OrbitControls( camera, container );
50+
controls.target.set( 0, 1.6, 0 );
51+
controls.update();
52+
4953
var geometry = new THREE.BoxBufferGeometry( 0.5, 0.8, 0.5 );
5054
var material = new THREE.MeshStandardMaterial( {
5155
color: 0x444444,

0 commit comments

Comments
 (0)