VR custom mesh controller orientation

Hello everyone !

I am actually trying to make a game for oculus quest with the unity exporter.
I added an object to the scene via unity editor (a sword).

I would like to replace the default oculus touch model by the sword.
The problem is : when i use the attachToMesh method and the getMeshByName method, it works but my sword has not the good orientation. I tried to change its rotationQuaternion with no succes.

I tried another way : by parenting the defualt mesh and the sword. In this case, the oriantation is OK but i cannot manage to make the default model invisible.

Please, help ! So frustrating !

Welcome to the forum !!!

Ping both @MackeyK24 the unity exporter master and @trevordev for the occulus controller mesh support.

Thank you !
I am sorry but i don’t know how to ping someone in this forum…
Can you tell ?
Thanks

just use @ and the pseudo of the ppl you need.

@MackeyK24
@trevordev

I ping as i was suggested to.
I thank you in advance for any help.

Hey @NicoDev,

For the case where the sword doesn’t have a good orientation, you could add a parent to your mesh and rotate the child but then use attachToMesh with the parent.

In the other way you tried, making the default model invisible should work by getting the controller mesh

var controllerMesh = webVRController.mesh;
controllerMesh.isVisible = false
controllerMesh.getChildMeshes(false).forEach((child)=>{
    child.isVisible = false
})

Another option for custom controller meshes I would look at Use the WebVR experience helper - Babylon.js Documentation in the Accessing vr device position and rotation section which has an example of manually positioning meshes. This way you can handle all the logic yourself.

Hope this helps

1 Like

Excellent @trevordev !
I tried the first solution and it works like a charm !
Thanks !

1 Like