如何改变io3d家具的材质?

时间:2017-07-29 05:10:06

标签: aframe archilogic 3d.io

家具可以有多种材料,例如:

<a-entity id="shelf" io3d-furniture="id:10344b13-d981-47a0-90ac-f048ee2780a6"></a-entity>

现在这个架子有很多材料:

> 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

如何更改资料?

1 个答案:

答案 0 :(得分:3)

可以通过HTML或JavaScript更改材料。

<强> 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()

请注意,材质名称区分大小写。