Using Threejs + OrbitContols in TypeScript

前端 未结 14 1278
清歌不尽
清歌不尽 2021-02-07 11:59

I\'m not able to get this example of using the aforementioned combo going in TypeScript.

I have and <

14条回答
  •  春和景丽
    2021-02-07 12:38

    I tried some of the suggested solutions and could not get it to work right so after some experimentation, I ended up with:

    import * as THREE from 'three';
    import OrbitControlsLibrary = require('three-orbit-controls');
    var OrbitControls = OrbitControlsLibrary(THREE);
    ...
    this.controls = new OrbitControls(this.camera);
    

    I am using webpack bundling and with this I did not have to add the script tag in the HTML template.

提交回复
热议问题