Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!