OrbitControls documentation is not updated

documentation mentioned to import { OrbitControls } from ‘three/addons/controls/OrbitControls.js’;

but it will throw an error ::
so i recommend you to import { OrbitControls } from ‘three/examples/jsm/controls/OrbitControls’;

Usually addons is a shortcut defined in the import map:

<script type="importmap">
  {
    "imports": {
      "three": "https://unpkg.com/three@0.149.0/build/three.module.js",
      "three/addons/": "https://unpkg.com/three@0.149.0/examples/jsm/"
    }
  }
</script>

so you can later do this:

import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { mergeBufferGeometries } from "three/addons/utils/BufferGeometryUtils.js";

1 Like