Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
包括angular cli中的Projector.js_Angular_Three.js_Angular Cli - Fatal编程技术网

包括angular cli中的Projector.js

包括angular cli中的Projector.js,angular,three.js,angular-cli,Angular,Three.js,Angular Cli,我正在开发一个基于angular cli的应用程序,其中使用了three.js。我可以将three.js与import*一起使用,作为“three”中的三个 但是我也想添加Projector.js。 我在.angular cli.json中添加了以下代码 "scripts": [ "../node_modules/three/build/three.js", "../node_modules/three/examples/js/renderers/Project

我正在开发一个基于angular cli的应用程序,其中使用了three.js。我可以将three.js与
import*一起使用,作为“three”中的三个
但是我也想添加
Projector.js
。 我在
.angular cli.json
中添加了以下代码

"scripts": [ 
        "../node_modules/three/build/three.js",
        "../node_modules/three/examples/js/renderers/Projector.js"        
      ],
我想创建一个投影仪对象,比如

projector: any = new THREE.Projector();
我的浏览器控制台出现错误,如下所示:

THREE.Projector has been moved to /examples/js/renderers/Projector.js.

如何在angular cli应用程序的组件中使用
projector.js

这不是在angular项目中添加
three.js
的方式。
您缺少打字,因此一旦安装了
tree.js
,您需要做的是:

添加@types/three-dev
npm安装@types/three-save dev

您还必须从
脚本
部分取出
three.js
Projector.js
参考

您的错误
THREE.Projector已移动到/examples/js/renderers/Projector.js。
意味着
Projector
东西已从核心移动到示例

/examples/js/renderers/Projector.js
只是一个示例的名称 文件因此,您必须将
Projector.js
的内容集成到一个角度组件中


例如:
const raycaster=new THREE.raycaster();const mouse=new THREE.Vector2()将正常工作。

我尝试这样做,但仍然收到相同的错误消息。您的意思是说将
Projector.js的内容复制/粘贴到我的组件中吗?你能再解释一下吗?“怎么做呢?”斯里吉什克斯我刚刚澄清了答案的这一部分。基本上,您必须将代码转换为angular componemt,就好像您只是复制粘贴它可能不起作用一样。这应该有
three.js
标记吗?它看起来更像是一个javascript/typescript/build system/angular问题,只是碰巧尝试从三个(可以是任何其他库)
npm安装树导入一个模块,
npm install@types/three——保存dev
,然后您可以通过从“three”中将该
import*导入为三个来在组件中使用它
like
const raycaster=new THREE.raycaster();const mouse=new THREE.Vector2()