aframearchilogic3d.io

How to change the material of io3d-furniture?


Furniture can have multiple materials, for example:

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

Now this shelf has a bunch of 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

How can I change the material?


Solution

  • The materials can be changed either via HTML or via 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()
    

    Note that the material names are case-sensitive.