2

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

<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

如何更改材料?

4

1 回答 1

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

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

于 2017-07-29T05:10:06.463 回答