Three.js OrbitControls/MapControls not working

I have "expo-three": "^5.2.0" and "three": "^0.110.0", and planning to use MapControls and to support both web and Android devices.

When I implement and test OrbitControls with the following code, I’m getting such error “the 2nd parameter is now mandatory” on an Android emulator:

import { THREE } from 'expo-three';
// global.THREE = global.THREE || THREE;
import 'three/examples/js/controls/OrbitControls';

let controls;
//...
      onCreate={props => {
        //...
        controls = new THREE.OrbitControls(camera);
      }
      onUpdate={() => {
        controls.update();
        //...
      }}

Even though I implement OrbitControls as the following, it’s still not working on both platforms and seems no effect without any warning:

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

Is there any updated guide to use camera controls such as OrbitControls or MapControls on both web and Android platforms? Thanks!

1 Like

Sounds to me like:

  1. That’s a three.js issue.
  2. You’re using an outdated version of the OrbitControls.

Try using the OrbitControls that comes with three.js. If you are, file an issue with three.js.
Are you listening to touch events? I think you might have to do that manually, since OrbitControls assume a web context. Not sure though.

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