Aframe angular 7无法加载gltf模型 [英] Aframe angular 7 unable to load gltf model
问题描述
我正在尝试使用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:警告未找到 #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
有人可以看一下并提供帮助吗?
Could someone please take a look and help?
谢谢
推荐答案
可能是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屋!