首页 \ 问答 \ Three.js + Threex + Javascript:“fromArray不是函数”?(Three.js + Threex + Javascript: “fromArray is not a function”?)

Three.js + Threex + Javascript:“fromArray不是函数”?(Three.js + Threex + Javascript: “fromArray is not a function”?)

我真的尽我所能,通过我自己的研究来解决这个问题,但不幸的是,我是一个绝对的新手,拥有three.js和javascript,我真的需要一些帮助。

我试图从threex(谷歌threex - 我不能发布另一个链接)到我的three.js场景中导入模型。 不幸的是,当我按如下方式添加代码时:

    var spaceship = null;
THREEx.SpaceShips.loadSpaceFighter03(function(object3d){
    scene.add(object3d)
    spaceship = object3d
})

我结束了一个空白的场景,并在我的JavaScript控制台中出现这个错误:

Uncaught TypeError :(中间值).fromArray不是函数。:8000/bower_components/threex.spaceships/examples/vendor/three.js/examples/js/loaders/MTLLoader.js:299

这导致了我在MTLLoader.js(无论那个文件是什么)中(可能是)有问题的代码行。

params[ 'ambient' ] = new THREE.Color().fromArray( value );

我不知道发生了什么,我想我的头脑有点过头了。 有人知道如何解决这个问题吗?

我正在学习本教程: https//www.youtube.com/watch?v = vw5_YyM4hn8 (如果有帮助,本教程的这个部分的示例代码可以在这里找到: https//github.com/jeromeetienne /flying-spaceship-minigame/blob/master/step1-01-naked-spaceship.html - 我看不到任何问题 - 至今我都试图非常仔细地遵循这些步骤。)

提前致谢。


I've really tried my best to solve this with my own research, but unfortunately I'm an absolute novice with three.js and javascript and I really need some help.

I am trying to import a model from threex (google threex -- I can't post another link) into my three.js scene. Unfortunately, when I add the code to do so as follows:

    var spaceship = null;
THREEx.SpaceShips.loadSpaceFighter03(function(object3d){
    scene.add(object3d)
    spaceship = object3d
})

I end up with a blank scene, and this error in my javascript console:

Uncaught TypeError: (intermediate value).fromArray is not a function.:8000/bower_components/threex.spaceships/examples/vendor/three.js/examples/js/loaders/MTLLoader.js:299

Which leads me to the (supposedly) offending line of code in MTLLoader.js (whatever that file is.)

params[ 'ambient' ] = new THREE.Color().fromArray( value );

I don't know what's happening, and I'm in a bit over my head I think. Does anybody know how to fix this?

I am working off of this tutorial: https://www.youtube.com/watch?v=vw5_YyM4hn8 (if it helps, the sample code for that segment of the tutorial is found here: https://github.com/jeromeetienne/flying-spaceship-minigame/blob/master/step1-01-naked-spaceship.html -- I can't see any problems -- I've so far tried to follow the steps very closely.)

Thanks in advance.


原文:https://stackoverflow.com/questions/30002500
更新时间:2024-01-30 10:01

最满意答案

我解决了使用另一个端口这样的事情

server {
listen 85 ;
listen [::]:85 ;
server_name ip:85 ;
root /var/www/html/projectfolder1;
}
server {
listen 90 ;
listen [::]:90 ;
server_name ip:90 ;
root /var/www/projectfolder2;
}

希望帮助一些人


I solved using another port some thing like that

server {
listen 85 ;
listen [::]:85 ;
server_name ip:85 ;
root /var/www/html/projectfolder1;
}
server {
listen 90 ;
listen [::]:90 ;
server_name ip:90 ;
root /var/www/projectfolder2;
}

hope that help some one

相关问答

更多
  • 无论您是在shell中启动nginx还是使用守护进程服务(只是命令行API的包装),答案都在命令行API中 。 如你所知,默认位置nginx寻找配置文件是/etc/nginx/nginx.conf,但你可以用-c标志传入任意路径。 例如: $ nginx -c /usr/local/nginx/conf 其他一些说明: 我怀疑在你的服务器块中重复“index.html”有什么好的理由。 我会将你的配置文件命名为“nginx.conf”(你目前表明它只是名为“conf”)。 这是标准。 熟悉另一个命令行标志 ...
  • 尝试 location ~ ^/(first/location|second/location)/ { ... } 〜表示使用正则表达式的url。 ^表示从第一个字符检查。 这将寻找一个/后面的任一位置,然后另一个/。 Try location ~ ^/(first/location|second/location)/ { ... } The ~ means to use a regular expression for the url. The ^ means to check from th ...
  • 你的第一次捕获可能太贪心了,你应该通过使用来限制它: rewrite ^(/[^/]+/[^/]+)/(.*)$ $1/index.php?$2 last; 在正则表达式上查看此有用资源 。 Your first capture is probably too greedy, you should limit it by using: rewrite ^(/[^/]+/[^/]+)/(.*)$ $1/index.php?$2 last; See this useful resource on regul ...
  • 假设父目录是www ,我认为下面的配置(从这篇文章 )将工作: server { # ... root /var/www/legacy; index index.php index.html index.htm; location / { try_files $uri $uri/ $uri.html $uri.php?$query_string; } location /laravel { alias /var/www/pu ...
  • 我解决了使用另一个端口这样的事情 server { listen 85 ; listen [::]:85 ; server_name ip:85 ; root /var/www/html/projectfolder1; } server { listen 90 ; listen [::]:90 ; server_name ip:90 ; root /var/www/projectfolder2; } 希望帮助一些人 I solved using another port some thing like t ...
  • 好吧所以这个问题比我想象的要简单。 我正在使用不支持ssl的免费cloudflare dns指向。 我切换到使用namescheap dns,它开始工作。 okay so the problem was simpler than I thought. I was using the free cloudflare dns pointing which didn't support ssl. I switched to using the namescheap dns and it started worki ...
  • 大多数文件夹应该是正常的“ 755 ”和文件,“ 644 ”。 对于基于nix的操作系统。 使用以下内容。 sudo chgrp -R www-data storage bootstrap/cache sudo chmod -R ug+rwx storage bootstrap/cache Most folders should be normal "755" and files, "644". For nix based OSs. Use the following . sudo chgrp -R ww ...
  • 版本5.4和5.5( 发行说明 )之间的Laravel加密代码没有向后不兼容的更改,因此只要您使用相同的APP_KEY和相同的加密算法,您就可以在应用程序中解密数据。 There's no backward incompatible changes in Laravel Encryption code between versions 5.4 and 5.5 (release notes) so as long as you use the same APP_KEY and the same encrypt ...
  • 没有办法自动执行此操作, 如果您使用的是相同版本的Laravel。 您可以通过移动您编辑的文件手动合并,例如模型,控制器,任何中间件,您的视图,迁移,您需要的公用文件夹中的任何文件。 一步一步,你最终将合并它们。 There is no way to do this automatically, If you are using the same version of Laravel. you can merge manually by moving the files you edited, for ex ...
  • 项目的放置没有真正的标准。 也就是说,您最常找到以下建议: /var/www/ (或者,最近, /var/www/html/ ) 这是Debian衍生品(如Mint)上的Apache寻找“默认”网站的默认位置。 许多人,一旦他们禁用了“默认”网站,只需将他们所有的网站都放在这个位置。 这也意味着如果保留默认网站,则可以将项目作为其子文件夹进行访问。 (但请注意,为了利用这一点,您的应用程序必须构建为具有多个路径的访问权限。) /srv/www/ /srv在FHS中定义为“由系统提供的站点特定数据”。 这可能 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)