Aframe angular 7 无法加载 gltf 模型 [英] Aframe angular 7 unable to load gltf model

查看:48
本文介绍了Aframe angular 7 无法加载 gltf 模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Angular 7 在 Aframe 中显示 gltf 模型.

I am trying to display a gltf-model in Aframe using Angular 7.

 `<a-scene embedded="" cursor="rayOrigin: mouse">
  <a-assets>
    <a-asset-item id="bedroom" src="../../assets/models/homedesign/scene.gltf"></a-asset-item>
  </a-assets>

   <a-entity id="camera" camera="" position="0 0 0" look-controls wasd-controls>
   </a-entity>        

  <a-entity id="room" gltf-model="#bedroom" position="-14 -30 -125" rotation= "0 160 0" material-map="map: map">
  </a-entity> 

</a-scene>
`

但是没有显示模型,我在控制台日志中看到以下消息 -

But the model is not displayed and I see the following message in the console log -

core:propertyTypes:warn "#bedroom" 资产未找到.

core:propertyTypes:warn "#bedroom" asset not found.

提到的路径是正确的,因为我可以在代码编辑器中从 html 打开 gltf 文件.

The path mentioned is correct as I am able to open the gltf file from the html in the code editor.

此外,所有其他原语(例如a-box"等)都会显示.

Also, all other primitives such as "a-box" etc.. get displayed.

这是我的应用程序文件夹结构的屏幕截图 -

Here is a screenshot of my app folder structure -

html 在 homedecor.component.html 中,gltf 文件在 homedesign 文件夹中.我使用 ng serve

the html is in homedecor.component.html and the gltf file is inside homedesign folder. I start the server using ng serve

有人可以帮忙看看吗?

谢谢

推荐答案

可能是 Angular 把事情搞砸了,你需要延迟添加卧室实体,以便资产可以先附加.由于这个原因,我不建议使用 Angular/Typescript 堆栈,因为它会引入许多我们无法真正帮助解决的复杂问题.

Probably Angular is messing things up and you need to delay adding the bedroom entity so assets can attach first. I don't recommend using Angular / Typescript stack for this reason as it introduces lots of complicated problems that we can't really help with.

这篇关于Aframe angular 7 无法加载 gltf 模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆