Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrbitControls example: modify scene #12742

Merged
merged 1 commit into from
Feb 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions examples/misc_controls_orbit.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@
container.appendChild( renderer.domElement );

camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.z = 500;
camera.position.set( 400, 200, 0 );

controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.addEventListener( 'change', render ); // remove when using animation loop
// enable animation loop when using damping or autorotation
//controls.enableDamping = true;
//controls.dampingFactor = 0.25;
controls.enableZoom = false;
controls.minDistance = 100;
controls.maxDistance = 500
controls.maxPolarAngle = Math.PI / 2;

// world

Expand All @@ -88,7 +90,7 @@

var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = ( Math.random() - 0.5 ) * 1000;
mesh.position.y = ( Math.random() - 0.5 ) * 1000;
mesh.position.y = 0;
mesh.position.z = ( Math.random() - 0.5 ) * 1000;
mesh.updateMatrix();
mesh.matrixAutoUpdate = false;
Expand Down Expand Up @@ -133,7 +135,7 @@

requestAnimationFrame( animate );

controls.update(); // required if controls.enableDamping = true, or if controls.autoRotate = true
//controls.update(); // only required if controls.enableDamping = true, or if controls.autoRotate = true

stats.update();

Expand Down