Hi!
i try 2 scene, .CreateForMesh .LayerMask etc i can’t do it
click in corner right
Hi!
i try 2 scene, .CreateForMesh .LayerMask etc i can’t do it
click in corner right
Hello @Joffrey_Vedlem_Ved , how are you doing?
Just to be sure on what you are trying to do. You have two cameras and want the same GUI to be rendered in both of them? (render GUI twice)
Or do you have you screen been split into two cameras, and you want you GUI to be render on top of them both?
Hi,
I am not registered in this tool so I don’t think I can save it, but I fixed for you (I suppose).
I believe what you want is to show the GUI only on top of the main scene and not in the viewport/minimap, correct?
If, so you need to add a third cam because you cannot use the ortho camera (1) nor the viewport camera (3). So what I did is I created a gui camera and did set a layerMask to this camera only.
The other step you forgot is that for the ‘advancedDynamicTexture’ .layer you also need to assign the same layerMask than the one of your camera used to display the GUI.
Finally, there’s the order in which you attach the activeCameras to the scene.
So, in short it goes something like this:
// Créez une caméra orbitale
var camera1 = new BABYLON.ArcRotateCamera("camera1", 0, 0, 10, new BABYLON.Vector3(0, 0, 0), scene);
camera1.setPosition(new BABYLON.Vector3(0, 5, -10));
camera1.attachControl(canvas, true);
var guicamera = new BABYLON.ArcRotateCamera("guicamera", 0, 0, 10, new BABYLON.Vector3(0, 0, 0), scene);
guicamera.attachControl(canvas, true);
guicamera.layerMask = 0x10000000;
var camera3 = new BABYLON.ArcRotateCamera("arcCamera",
0, // alpha
0, // beta
0, // radius
BABYLON.Vector3.Zero(), // target
scene);
camera3.attachControl(canvas, true);
scene.activeCameras = [camera1, guicamera, camera3];
const advancedTexture1 = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("ui");
advancedTexture1.layer.layerMask = guicamera.layerMask;
Hope this helps and have a great day
Yo @mawa fix a problem!, excuse me if I expressed myself badly, in the context I should have been more visully speaking, I wanted only a hud on a single camera, and not to have this bug of having this GUI on the 2 cameras
oh my god, how did you do! thank you, I had tried but I had to do very badly, a big thank you to you! I didn’t believe it anymore haha
oh you have to have another camera in +, I would never have found. it works!.
PS:
works! : advancedTexture1.layer.layerMask = guicamera.layerMask;
whose work: advancedTexture1.layerMask = guicamera.layerMask;
interesting
The advancedDynamicTexture is embedded in ‘a layer’. To control how this layer is rendered in the scene (i.e. for order, post, etc…), you have to call its ‘.layer’. Else, you would just call the advancedDynamicTexture itself, which won’t do anything in terms of how this layer of ADT is rendered in the scene.
Glad you made it and GL with your project. Have a great day