GUI `linkWithMesh` not behaving properly using right handed system

Hello everyone!

I have 2 scenes, one for 3D and one for GUI (separated because of post processes), and I am using the right handed system.

I noticed something odd when using linkWithMesh, the z coordinate seems to be flipped as the gui now renders behind the camera and not on the sphere:

I think this might be a bug, maybe also I missed something important ^^

@RaananW can you have a look ?

1 Like

That’s a bug for sure. Assigning to me, will work on fixing it.

1 Like

Sorry, not a bug! :slight_smile:

This is an issue with your render loop. Do this instead, and problem is solved - Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)

2 Likes

Thank you very much :pray:

I am still a bit puzzled because you removed scene.render() from the render loop and somehow it is still being rendered :joy: ?

Also, this works when the main camera has no parents, but if I have a parent, then I need to assign the world rotation of the main camera to the ui camera. How can I do that without using the absoluteRotation quaternion?

First about the scene.render - running a render loop does not remove the other running render loop. the playground itself has already a render loop that renders the default scene. so you don’t need it again.

Second - about the camera - you technically want a clone of the camera. Meaning - you need to also copy the view matrix. I’ll be honest and say I will need to dive into the code to know why all 3 are needed, but, in general, this will work - Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)

1 Like

I didn’t know we could have multiple render loops! Your solution works perfectly for me :ok_hand:

Thanks a lot !!!

1 Like

As a final note, here is a PG without the potential memory leak:

This is not the most beautiful solution as it breaks if new observers are added to onViewMatrixChangedObservable :sweat_smile:

I am really curious why this one does not work with a simple copy of the view matrix: