How to add camera controls to an app created with the editor?

Hi, I am using the following app.json code for my app.

var loader = new THREE.FileLoader();
loader.load( 'app.json', function ( text ) {
	var player = new APP.Player();
	player.load( JSON.parse( text ) );
	player.setSize( window.innerWidth, window.innerHeight );;
	document.body.appendChild( player.dom );
	window.addEventListener( 'resize', function () {
	player.setSize( window.innerWidth, window.innerHeight );	
	} );
} );

This was generated by Three.js after I exported my model to GLTF.
How do I get to Zoom, Pan, Tilt my model in the browser. I have been looking and reading everything and nowhere have I found a way.
Can you point me in the right direction?

Go to your exported files and include OrbitControls into index.html. For example:

<script src="js/three.min.js"></script>
<script src="js/app.js"></script>
<script src=""></script>

Open app.js and add the following line under: this.setCamera( loader.parse( ) );.

var controls = new THREE.OrbitControls( camera, renderer.domElement );

I don’t know if there is a way to apply OrbitControls directly in the editor. In general it would be better if users don’t need to modify the exported source files.

Maybe useful:

Hi Murgen87, the first option did not work for me. Then I followed the 2nd option:

How do you add controls from inside the three.js editor

Now I can manipulate my model, Thank you for your time.

Adonis Richards

Hi @Mugen87,

I am not a veteran in coding.

How can I create a walkthrough for my model?

I searched the web and I found the following:

This is exactly what I want for my walkthrough, that the animated camera journeys through my model.

Do you know of a explanation or course where I can gather knowledge in creating a spline, attaching a camera to it and create my walkthrough?

Following is a link to my model.

I did some research on the web, YouTube and concluded that I should study some WEBGL.

But now I am halfway through the book: WEBGL for beginners, I have not found what I am looking for.

I have shared the question on stackoverflow:

without success.

Can you point me in the right direction?

Kind regards,

Adonis Richards

Unfortunately not. I think it’s best when you study the examples and the related code in the library.

You basically define a path with a curve or a sequence of curves. Then you sample this path in order to get new position values for your camera. By using camera.lookAt() you can ensure that the camera always looks to the model.

Simple demo: Edit fiddle - JSFiddle - Code Playground