如何更改 io3d-furniture 的 material?
How to change the material of io3d-furniture?
家具可以有多个material,例如:
<a-entity id="shelf" io3d-furniture="id:10344b13-d981-47a0-90ac-f048ee2780a6"></a-entity>
现在这个架子上有一堆 materials:
> console.log(document.getElementById('shelf').components['io3d-furniture'].availableMaterials.Wood)
< [ Oak stained aqua blue,
Oak stained pink pastell,
Black Walnut Tree,
Oak stained chalk,
Oak stained dark warmgrey,
Oak stained mint blue,
Oak stained graphite grey,
Oak stained salmon pink,
Oak stained graphite black,
Oak stained light warmgrey,
Oak stained cold grey,
European Oak
如何更改 material?
可以通过 HTML 或 JavaScript 更改 material。
HTML:
<a-entity id="shelf" io3d-furniture="id:10344b13-d981-47a0-90ac-f048ee2780a6;material_Wood:Black Walnut Tree"></a-entity>
JavaScript:
var component = document.getElementById('shelf').components['io3d-furniture']
component.data.material_Wood = 'Black Walnut Tree'
component.update()
请注意 material 名称区分大小写。
家具可以有多个material,例如:
<a-entity id="shelf" io3d-furniture="id:10344b13-d981-47a0-90ac-f048ee2780a6"></a-entity>
现在这个架子上有一堆 materials:
> console.log(document.getElementById('shelf').components['io3d-furniture'].availableMaterials.Wood)
< [ Oak stained aqua blue,
Oak stained pink pastell,
Black Walnut Tree,
Oak stained chalk,
Oak stained dark warmgrey,
Oak stained mint blue,
Oak stained graphite grey,
Oak stained salmon pink,
Oak stained graphite black,
Oak stained light warmgrey,
Oak stained cold grey,
European Oak
如何更改 material?
可以通过 HTML 或 JavaScript 更改 material。
HTML:
<a-entity id="shelf" io3d-furniture="id:10344b13-d981-47a0-90ac-f048ee2780a6;material_Wood:Black Walnut Tree"></a-entity>
JavaScript:
var component = document.getElementById('shelf').components['io3d-furniture']
component.data.material_Wood = 'Black Walnut Tree'
component.update()
请注意 material 名称区分大小写。