Equirectangular not work on Ipad

Hi, i made an html page to load an equirectangular panorama. It works fine in Firefox in my computer with my mouse, but when I load the page in my Ipad, nothing happens when I put my finger in the screen… do you know why?

Many thx…

Here is the result

And here is the code

<!doctype html>
<html>
  <head>
		<title>PANORAMA-SONA</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background-color: #000000;
				margin: 0px;
				overflow: hidden;
			}
			#info {
				position: absolute;
				top: 0px; width: 100%;
				color: #ffffff;
				padding: 5px;
				font-family:Monospace;
				font-size:13px;
				font-weight: bold;
				text-align:center;
			}
			a {
				color: #ffffff;
			}
		</style>
	</head>
<body>
    
  <div id="container"></div>
		
  
  <script src="three.js"></script>
  
  <script>
			var camera, scene, renderer;
			var isUserInteracting = false,
			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
			lon = 0, onMouseDownLon = 0,
			lat = 0, onMouseDownLat = 0,
			phi = 0, theta = 0;
			init();
			animate();
			function init() {
				var container, mesh;
				container = document.getElementById( 'container' );
				camera = new THREE.PerspectiveCamera( 95, window.innerWidth / window.innerHeight, 1, 1100 );
				camera.target = new THREE.Vector3( 0, 0, 0 );
				scene = new THREE.Scene();
				var geometry = new THREE.SphereBufferGeometry( 500, 60, 40 );
				// invert the geometry on the x-axis so that all of the faces point inward
				geometry.scale( - 1, 1, 1 );
				var material = new THREE.MeshBasicMaterial( {
					map: new THREE.TextureLoader().load( 'image.JPG' )
				} );
				mesh = new THREE.Mesh( geometry, material );
				scene.add( mesh );
				renderer = new THREE.WebGLRenderer();
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( window.innerWidth, window.innerHeight );
				container.appendChild( renderer.domElement );
				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
				document.addEventListener( 'wheel', onDocumentMouseWheel, false );				
				window.addEventListener( 'resize', onWindowResize, false );
			}
			function onWindowResize() {
				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();
				renderer.setSize( window.innerWidth, window.innerHeight );
			}
			function onDocumentMouseDown( event ) {
				event.preventDefault();
				isUserInteracting = true;
				onMouseDownMouseX = event.clientX;
				onMouseDownMouseY = event.clientY;
				onMouseDownLon = lon;
				onMouseDownLat = lat;
			}
			function onDocumentMouseMove( event ) {
				if ( isUserInteracting === true ) {
					lon = ( onMouseDownMouseX - event.clientX ) * 0.1 + onMouseDownLon;
					lat = ( event.clientY - onMouseDownMouseY ) * 0.1 + onMouseDownLat;
				}
			}
			function onDocumentMouseUp( event ) {
				isUserInteracting = false;
			}
			function onDocumentMouseWheel( event ) {
				var fov = camera.fov + event.deltaY * 1;
				camera.fov = THREE.Math.clamp( fov, 10, 75 );
				camera.updateProjectionMatrix();
			}
			function animate() {
				requestAnimationFrame( animate );
				update();
			}
			function update() {
				if ( isUserInteracting === false ) {
					lon += 0.1;
				}
				lat = Math.max( - 85, Math.min( 85, lat ) );
				phi = THREE.Math.degToRad( 90 - lat );
				theta = THREE.Math.degToRad( lon );
				camera.target.x = 500 * Math.sin( phi ) * Math.cos( theta );
				camera.target.y = 500 * Math.cos( phi );
				camera.target.z = 500 * Math.sin( phi ) * Math.sin( theta );
				camera.lookAt( camera.target );
				/*
				// distortion
				camera.position.copy( camera.target ).negate();
				*/
				
				renderer.render( scene, camera );
			}
  </script>
		
</body>
</html>

You need to add support for touch events.

Thx prisoner849

Do I need OrbitControls?

Creativity is up to you ) If you need functionality of THREE.OrbitControls(), then, of course, you can use it.

Hi,

I’m lost, sorry, here is the code I’ve changed : but no way…

<script>
			var camera, scene, renderer;
			var isUserInteracting = false,
			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
			lon = 0, onMouseDownLon = 0,
			lat = 0, onMouseDownLat = 0,
			phi = 0, theta = 0;
			init();
			animate();
			function init() {
				var container, mesh;
				container = document.getElementById( 'container' );
				camera = new THREE.PerspectiveCamera( 95, window.innerWidth / window.innerHeight, 1, 1100 );
				camera.target = new THREE.Vector3( 0, 0, 0 );
				scene = new THREE.Scene();
				var geometry = new THREE.SphereBufferGeometry( 500, 60, 40 );
				// invert the geometry on the x-axis so that all of the faces point inward
				geometry.scale( - 1, 1, 1 );
				var material = new THREE.MeshBasicMaterial( {
					map: new THREE.TextureLoader().load( 'image.JPG' )
				} );
				mesh = new THREE.Mesh( geometry, material );
				scene.add( mesh );
				renderer = new THREE.WebGLRenderer();
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( window.innerWidth, window.innerHeight );
				container.appendChild( renderer.domElement );
				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
				document.addEventListener( 'wheel', onDocumentMouseWheel, false );					
				window.addEventListener( 'resize', onWindowResize, false );
								
				document.addEventListener('touchmove', process_touchmove, false);
				document.addEventListener("touchstart", process_touchstart, false);
			}
			
			function process_touchmove(event) {
			
				if ( isUserInteracting === true ) {
					lon = ( onMouseDownMouseX - event.clientX ) * 0.1 + onMouseDownLon;
					lat = ( event.clientY - onMouseDownMouseY ) * 0.1 + onMouseDownLat;
				}
			}
			
			function process_touchstart(event) {
			
				event.preventDefault();
				isUserInteracting = true;
				onMouseDownMouseX = event.clientX;
				onMouseDownMouseY = event.clientY;
				onMouseDownLon = lon;
				onMouseDownLat = lat;
			}
			
			function onWindowResize() {
				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();
				renderer.setSize( window.innerWidth, window.innerHeight );
			}
			function onDocumentMouseDown( event ) {
				event.preventDefault();
				isUserInteracting = true;
				onMouseDownMouseX = event.clientX;
				onMouseDownMouseY = event.clientY;
				onMouseDownLon = lon;
				onMouseDownLat = lat;
				
			}
			function onDocumentMouseMove( event ) {
				if ( isUserInteracting === true ) {
					lon = ( onMouseDownMouseX - event.clientX ) * 0.1 + onMouseDownLon;
					lat = ( event.clientY - onMouseDownMouseY ) * 0.1 + onMouseDownLat;
				}
				
			}
			function onDocumentMouseUp( event ) {
				isUserInteracting = false;
				
			}
			function onDocumentMouseWheel( event ) {
				var fov = camera.fov + event.deltaY * 1;
				camera.fov = THREE.Math.clamp( fov, 10, 75 );
				camera.updateProjectionMatrix();
			}
			function animate() {
				requestAnimationFrame( animate );
				update();
			}
			function update() {
				if ( isUserInteracting === false ) {
					lon += 0.1;
				}
				lat = Math.max( - 85, Math.min( 85, lat ) );
				phi = THREE.Math.degToRad( 90 - lat );
				theta = THREE.Math.degToRad( lon );
				camera.target.x = 500 * Math.sin( phi ) * Math.cos( theta );
				camera.target.y = 500 * Math.cos( phi );
				camera.target.z = 500 * Math.sin( phi ) * Math.sin( theta );
				camera.lookAt( camera.target );
				/*
				// distortion
				camera.position.copy( camera.target ).negate();
				*/
				
				renderer.render( scene, camera );
			}
  </script>

Because you do it in the wrong way. Look at the source code of THREE.OrbitContorls() and see how it supports touch events and how it gets coordinates of a touch.

Many thx, it works…