How to replace controller meshes in VR mode?

I am trying to replace the rootMesh in controller meshes for webXR so far I was able to do it using

  controller.onMotionControllerInitObservable.add((motionController) => {                                                            
       motionController.setEnabled(false);                                                                                              
       controller.onMeshLoadedObservable.add((mesh)=>{                                                                                  
         motionController.rootMesh =  BABYLON.MeshBuilder.CreateBox(`mycontrol`, {height: 0.1,width: 0.1, depth: 0.1}, scene);          
         motionController.rootMesh.material = new BABYLON.SimpleMaterial(`mathrash_${0}`,scene);                                        
         motionController.rootMesh.material.diffuseColor= new BABYLON.Color3(1,0,0);                                                    
                                                                                                                                        
       });         

It works on the webxr emulator but rendering the same page on a real quest 2 the black controllers appears.

Hi @Fito_Maticus and welcome to the forum

Let me ping XR King @RaananW

Hey, welcome to the forum :slight_smile:

Would you be able to create a playground for me to see the entire process? This way I will also know I am working with the same code as you are.

Thanks!

Dam, guys sorry for making you waste your time, I found my problem. the web server I am using to serve my experience to my quest 2 was chaching a file and thats why couldn’t see the same result
I tested the mesh controller replace with this
https://playground.babylonjs.com/#JLL0KS#1

1 Like

No time wasted :slight_smile:
I am just happy you have the issue resolved!