Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Changing avatars in network a-frame based on user's preference

I'm creating a multi user VR game environment where user can select their own avatar with movement constraint to nav-mesh, I created a component as such for changing avatar

AFRAME.registerComponent("update-gltf-model", {
  schema: {
    src: {type: 'model'},
    sync: {default: false}
  },
  update() {
    if (this.data.src && this.data.sync) {
      this.el.setAttribute('gltf-model', this.data.src);
    }
  }
});

and based on user selecting the radio button I called a function handle click to set different gltf-model

function handleClick(detail) {
        const id = detail.value;
        document.getElementById('cameraRig').setAttribute('update-gltf-model', 'src', '#' + id);
      }

where details comes from the appropriate radio button selected. My camera is networked and constrained to nav-mesh

<a-entity class="avatar-head"
          id="cameraRig"
          camera="near:0.01;"
          look-controls="pointerLockEnabled: false"
          networked="template:#head-template;attachTemplateToLocal:false;"
          wasd-controls="acceleration:20;"
          simple-navmesh-constraint="navmesh:.navmesh;fall:0.5;height:1.65;"
          position="0 1.65 0"
        ></a-entity>

I have also attached a working code in glitch. Help me out in this regard

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda