Measure distance between two meshes

I found this playground if you doubleclick on mesh surface the pin will be shown. My question is:
Is there any way/method to check what is length between those points?

Hi there,

if you know the positions of the endpoints, e.g. the first and second marker, than you can do some vector math.

Lets assume Cube1 and Cube2 are Meshes, Nodes etc. that define the start and end position.

You can subtract each Postion from another and then take the length of the result vector.


Keep in mind that they should be under the same parent or at least take the Absolute position to get a correct result.

Further keep in mind that the position is the origin of the Object, it is maybe not the exact location you want to measure. But if you create the “marker” or know where it should be placed this should not be a problem.

The Calculation is always the same as long as the position is a vector.

Hope i could help.

Edit: Babylon.js Playground <<-- Result is in console.log


Thank you very much, that’s it! :slight_smile: