Size scale attach to the camera

Hello everyone,

I would like a size scale in my playground. I tried with the GUI but he does not use the same unit of the mesh. (One on pixel or pourcentage the other random unit). I’m also trying to attach one mesh (which serves to unit) to the camera to follow this movement but if i move the positioning of the camera or I zoom with them my “unit” don’t expand.

For exemple in this picture I want the black line as the same size what ever if I zoom or move camera

If you have a solution or idea to do it, it would be perfect!

I set up a playground if you want test in my project : Babylon.js Playground

Sorry for my bad english, if you don’t understand something don’t hesitate to ask me.

Thank you for your help.

Hiya N! Your box is lookin’ great! I “had-to” make a “thin-panel” version… so I could see it without the z-fighting problem.

Ok, let’s clarify/reword a bit.

  1. You want to put a black line/mesh/whatever… on the surface of the box?
  2. The black thing must NOT get bigger/smaller when camera zooms in/out.
  3. The black thing must display in the same orientation/position… for any box size/scale.

That sounds VERY CLOSE to edgesRenderer. (lines 336-342)

Maybe I am off-topic. :slight_smile: The black lines get “proportionally” (proportionately?) -bigger/smaller with camera zoom, and the black lines can never be clickable. But, maybe this is what you seek.

Note: The ‘of’ in line 337 likely does not work in standard Internet Explorer. Use a more-standard for-loop syntax… for “non-Edge” IE versions.

1 Like

Ok :sweat_smile:, I’m probably not well explained.

I would like the same thing as this on “google maps”:
(On bottom right)

I don’t want to put a black line on the surface of the box it’s juste for explain :joy:

1 Like

I think multilines from GUI could solve that:

1 Like

The problem with this is the size of multilines is on px or % but mesh is not on px or %
It is necessary that I find the calculate for corresponding px or % on size of mesh ? :thinking:

You can give a mesh and the system will do the math for you. So just attach dummy meshes between two points and create a line between the two dummies

1 Like

I think I use this technique because, with multilines lines, it is not possible to attach it to the camera.

Thanks to the person who did his, but why the line is deform ?

The problem with this solution is if we change the size of the window the measurements are no longer true :disappointed_relieved:

I think it’s impossible or it’s too difficult for my level in JS and BABYLON

Never say never :slight_smile:
Let’s go back to whiteboard for a second: you have 3d coordinates right?

Here is an example that will draw lines between two 3d coordinates no matter what the window size is:

1 Like

Yes then I would like that if we move the camera it remains in the field of vision at the same place. This I succeeded with 2 scene but now the length of line don’t move and I would like the line move when i zoom.

sorry this is confusing :slight_smile: How do you want the line to move when zooming?

You have control over the 2 Vector3 that bind the line so you can do whatever you want with these 2 coordinates.

1 Like

Sorry is very difficult to explain because english is not my natal language and same in french is difficult to explain :sweat_smile:

I would like the line is the same size (length) of the object (Here the sphere) in the middle of playground.

I think you speak French so if you need details I can explain in French it would be clearer :fr:

Please use french! (Sorry guys, but user needs first :smiley: )

Donc en gros tu veux que ton trait fasse quoi?


Merci beaucoup.

Donc en gros j’aimerais que la longueur de mon trait fasse toujours la même taille que mon objet mais juste visuellement.

Quand on zoom la taille de la sphère de bouge pas mais visuellement elle est plus grande. Je voudrais donc que la longueur du trait représente visuellement cette taille.

Je veux exactement comme sur ce site (en bas à gauche) Plan Maison 3D Gratuit - Créez votre Plan 3D simplement | Kozikaza

J’espère que ça sera plus plaire comme ça. :laughing:

Alors du coup il suffit d’attacher deux meshes a la grosse sphere, de les placer correctement et ca devrait marcher:

1 Like

Très bien mais du coup pour que la ligne soit par exemple toujours en bas à droite du playground et qu’il sont attacher à la grosse sphère, il faut que place les 2 mesh en fonction de la caméra c’est bien sa ?

ha je crois que je commence a comprendre. Tu veux une echelle en fait?

1 Like

Oui c’est exactement ça !

Je te remercie énormément !

Here is a part of solution for my playground :

1 Like