How to disable surface tracking but still use gyroscope/accelerometer and move around

Hi everyone

In the cloud editor, is it possible somehow to disable the surface tracking for a world effect but still being able to walk around a scene ?

I want to make the scene appears at the given coordinate and only use the phone position and angle to walk around the scene

As I dont need any shadow on the ground for this one, I just would like to have a perfect stability

disableWorldTracking: true doesnt look to be the way as my models stick to the camera

I hope this is understandable

Thanksss :pray:

Hi! I’m trying to get a better understanding, are you looking to build an experience where the content is statically placed in a specific location and you use the device as your β€œeyes”?

Hi George and thank you for quick reply !

Yes exactly basically it is a simple AR World experience but the surface tracking is disabled

I had this sample code where there is just no surface tracking, just to show you or direct link to see (webXR) :
https://speckle-ruby-string.glitch.me/01.basic_scene_webxr.html

<!DOCTYPE html>
<html lang="en">

<head>
	<title>Basic Scene with WebXR</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<link type="text/css" rel="stylesheet" href="style.css">
  <script src="https://unpkg.com/three@0.133.0/build/three.js" crossorigin="anonymous"></script>
</head>

<body>
	<script type="module">    
    // To start an AR scene with webXR, we can use a handy button provided by three.js
    // We first have to import it because it is a javascript module
    import { ARButton } from 'https://unpkg.com/three@0.133.0/examples/jsm/webxr/ARButton.js';
    console.log(ARButton);
    
		let camera, scene, renderer;
    let mesh;

		init();
		animate();

		function init() {
			const container = document.createElement('div');
			document.body.appendChild(container);

			scene = new THREE.Scene();

			camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 40);

			renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
			renderer.setPixelRatio(window.devicePixelRatio);
			renderer.setSize(window.innerWidth, window.innerHeight);
      // This next line is important to to enable the renderer for WebXR
			renderer.xr.enabled = true; // New!
			container.appendChild(renderer.domElement);

			var light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 1);
			light.position.set(0.5, 1, 0.25);
			scene.add(light);

      const geometry = new THREE.IcosahedronGeometry(0.1, 1);
      const material = new THREE.MeshPhongMaterial({
        color      :  new THREE.Color("rgb(226,35,213)"),
        shininess  :  6,
        flatShading:  true,
        transparent: 1,
        opacity    : 0.8
      });
      
      mesh = new THREE.Mesh(geometry, material);
      mesh.position.set(0, 0, -0.5);
      scene.add(mesh);

			// Add the AR button to the body of the DOM
			document.body.appendChild(ARButton.createButton(renderer));

			window.addEventListener('resize', onWindowResize, false);
		}

		function onWindowResize() {
			camera.aspect = window.innerWidth / window.innerHeight;
			camera.updateProjectionMatrix();

			renderer.setSize(window.innerWidth, window.innerHeight);
		}

		function animate() {
			renderer.setAnimationLoop(render);
		}

		function render() {      
			renderer.render(scene, camera);
		}

	</script>
</body>

</html>```

@Jeremy_Immordino @GeorgeButler Camera movement is driven by our slam engine, so if you disable it then the camera won’t move. That said, you could create a 3DoF type experience where the gyro works to look around, but the camera would still be stationary:

By default, Android browsers generally have access to the gyro, but iOS doesn’t. You’d need to explicitly request gyro permissions if you set disableWorldTracking: true

If SLAM is disabled, but you still want to move around then you’d have to perhaps implement some UI buttons to drive the camera position through your scene.

2 Likes

Ok I understand thanks a lot @TonyT

1 Like

Finally I solved my jittering problem by scaling up my scene and it is now perfect, it was just too small :grin:

1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.