There are three items I've built into the options. So, I want to click on any one of the buttons to change the avatar as per the click. If anyone selected a male avatar so it should be reflected in others also. For example if there are 4 users. And from that 3 are male and 1 is female and the female selected a female avatar. So, she can able to see others as a male avatar and others can see her as a female avatar(.gltf model).
Is there any way to dynamically add the .gltf model in a-frame and also update it for others?
<body>
<!-- ============================ Start Model Selection ========================== -->
<div class="container" style="z-index: 1; position: fixed">
<div class="content_container content_container-1">
<div class="svg">
<img
src="https://s2.svgbox.net/illlustrations.svg?ic=selfie-boy"
alt="Boy"
/>
</div>
<div class="content content-1">Boy</div>
</div>
<div class="content_container content_container-1">
<div class="svg">
<img
src="https://s2.svgbox.net/illlustrations.svg?ic=selfie-girl"
alt="Girl"
/>
</div>
<div class="content content-2">Girl</div>
</div>
<div class="content_container content_container-1">
<div class="svg">
<img
src="https://s2.svgbox.net/illlustrations.svg?ic=my-robot"
alt="Robot"
/>
</div>
<div class="content content-3">Robot</div>
</div>
</div>
<!-- ============================ End Model Selection ========================== -->
<a-scene background="color: #FAFAFA">
<a-entity environment="preset: forest; grid: cross"></a-entity>
</a-scene>
This is the code I've written for this.
The docs mention syncing custom components (and
gltf-model
is a component), and it's quite simple. Lets say we want a model with the standard heads:Add the entity with the
gltf-component
to the networked template:Add it to the
NAF.schemas
:Add the model to your local client:
Create the
model-changer
component which changes the model when the images are clicked:Check it out in this glitch - the images should change the models: