3D mesh in the bottom right of the canvas

Hi everybody,

I don’t know if anybody’s still working but maybe will I be lucky.

I want to draw a mesh in the bottom right of the canvas facing the camera at any time and in front of all other meshes. I don’t want use the 2D Gui objects because i need 3D features.

I first tried to use the viewports but i don’t know how to see ONLY the concerned mesh and not the others.

The beginning of my playground is here https://playground.babylonjs.com/#Q88D2K#1 but i don’t know how to do that.

If anybody can help me.



PS : happy new year to all the forum

I think 2 cameras and 2 viewports could to the trick.
Use the same layerMask for the second camera and the desired mesh - In-Depth layerMask | Babylon.js Documentation
Let me know if you’ll need more help :slight_smile:

1 Like

Here’s a new playground.

There’s still one issue

  • the mesh is not in the bottom right of the canvas. the bottom right angle of my mesh should be in the bottom right.

Do you mean the small gap here or something else?

Yes, i don’t know how to calculate the exacr position of the camera which certainly depends on the size of the mesh

I think reading a bit on how camera projections work might be useful to work out how to calculate the camera’s parameters :slight_smile:


1 Like

Hello @bvaisman just checking in, do you have any more questions about this? :slight_smile:

Hello @carolhmj

No, you’re right, i have to think a little bit more about the problem. I will close the question.

1 Like