Draw line between two meshes

Hi there,

I’m just passionate about programing and i am trying do some simple task on the babylonjs playground.
Can anybody tell me why it did not show the line betwen those child mesh but I can view the line between parent meshes?


Welcome aboard!

You need to use positions in world coordinates but you currently use local coordinates. To do so, you should make sure the world matrix is computed (by calling computeWorldMatrix) and use mesh.absolutePosition instead of mesh.position:



Thanks for your quick response. The next obstacle that I have met others before when I drag or rotate the mesh it fill the space with lines, instead of just updating the line. Can you give me a hint for this problem?

It all depends where you create and instance the line https://playground.babylonjs.com/#6IGV3P#8 and not creating a new variable for each line.