Meshes connected by lines?

Hello!

What’s the easiest way to connect two meshes with a line, and when moving one of the meshes, move the head of line which is relative to the selected mesh as well?

Playground demo: https://www.babylonjs-playground.com/#LJ7TM5#5

probably using lines and on every frame updating the lines ends to be in sync with the meshes positions ?

I am hoping for something easier. In my app I have over 10 meshes which must be connected via lines based on some patterns… code management will be a nightmare…

Why ? you could definitely encapsulate the logic in a custom function/class/behavior (Behaviors - Babylon.js Documentation) to factorize it ?

https://www.babylonjs-playground.com/#LJ7TM5#6

2 Likes

Thank you all for your replies! I’ll take them one by one and study each case :smile: