我无法在TypeScript中使用上述组合的这个示例。
我在我的HTML <head>
中有 <script src="lib/three.min.js"></script>
和 <script src="lib/OrbitControls.js"></script>
,以及在 <body>
中有 TypeScript 文件:
/// <reference path="lib\three.d.ts" />
...
this.controls = new THREE.OrbitControls(this.camera); //there's the error
this.controls.addEventListener('change', this.render);
...
和
this.controls.update();
在被周期性调用的render()
函数中。据我所知,设置与示例相同,但在编译OrbitControls构造函数行时给我一个庞大的错误(缩写):
The property 'OrbitControls' does not exist on value of type '{REVISION:string;
CullFace: {[x: number ...
我猜这个错误涉及到整个Threejs,因为当我点击它时,Visual Studio立刻崩溃了:)感谢你的帮助。