EdgeRenderer with edge length written on edges


How to customize EdgeRenderer in such a way that it will write edge length on each edge?

Thanks in advance.

Lol that is more than customization :slight_smile:
The EdgeRenderer renders lines for you. To write the length I will suggest to use GUI and find a way to detect where is the center of each line so you can draw a text there.

The EdgeRenderer does not expose its buffer (_buffers) but if you need it I can expose it for you

1 Like

Thank you. I have gone thru the code but I have not understood anything as I don’t have any theoretical knowledge on 3D stuff. So, i don’t know whether I should ask for _buffers or not because I don’t know how it helps. Please educate me by throwing some links

Not sure to understand? Do you want me to give you a list of learning sites about 3D?

_buffers is an array of BABYLON.VertexBuffers that can give you direct access to a list of floats representing the positions used to render the edges

1 Like

and make sample in PG too
or any screenshot or pic from your wanted result

Hi gang.

POSSIBLY, SC would be happy with a bounding box rendering… with 12 GUI textBlocks - place upon small planes… positioned adjacent to the bounding box lines.

SC… um… Look at this playground/mesh.


It would take MANY GUI textblock “labels”… to put measurements along each blue line. MANY.

BUT… what if… you had measurement labels along the WHITE LINES (bounding box lines) of your mesh?

Would THAT (along the white lines) be enough measuring/labels for your project/idea?

Measurement labels placed around a mesh boundingBox (white lines)… is MUCH MUCH easier than using the edgesRender lines (blue). Thoughts?

1 Like

Thank you all,

My scene looks is an apartment. I need to show the dimensions of the floor like below.

I cannot use BoundingBox as my floor can be in a non rectangular shape (could be like L).

The algorithm I thought of is,

Step 1: Get all the facets whose normal is (0,1,0). //Now I will have all the triangles who form the top of my floor.

Step 2: Somehow do a polygon union/merge of all these triangles. //Now I will have a polygon with all the edges.

Step 3: Draw the arrows and edge lengths using DynamicTexture.

But I am not sure how to achieve this. I think I can achieve the step 1 with VerticesData. but could not find a way to achieve the step 2. Do we have any such algorithm available in BABYLON? If not, can you please recommend a library for this?

If there is a much simpler approach than my algorithm, please suggest.

Thanks a lot for your support.

1 Like

Did you create the apartment or are importing an apartment someone else made?

Someone else’s made. So, the solution should be generic and should work with any model. For now, the only agreement is the name of the floor mesh should start with “Floor_”. Tomorrow the system should be intelligent enough to identify floor meshes. (The logic could be like, the mesh.getBoundingIngo().boundingBox’s Y MAX is the least of all the remaining meshes)

Knowing that floors are named with floor_xxxx would be good. Just knowing that the facet normal is (0, 1, 0) is not sufficient since if walls have any thickness their base facets would also have normal (0, 1, 0). In the same way the bases of walls could have the same y value as the floor.

1 Like

No one could help me? :disappointed_relieved:

Hi @jerome,

Will you be able to help me here also?

Thanks in advance.

Hi, @trevordev and @sebavan,
Please help me to achieve Step 2 explained above

Pinging everybody does not add value to the thread and you do not need that for the community to help, just a little patience :slight_smile:

About 2, once you have all the points, you could use the createLines function to draw them ?

Hi @Sebavan, I am pinging saviors only when I am helpless. Because these saviors saved me everytime I was stuck. Regarding step 2, though I have all the points, these are triangles. I need to merge them. For example, take a rectangular ground with height 0. It will have two triangles. But I don’t need to display the diagonal length