Expandable lines

Ooh, I gotcha now I think, here’s a simple example of updating the connecting line each time one of the mesh endpoints is dragged. :slightly_smiling_face:

https://playground.babylonjs.com/#YEZPVT#837

Edit, it’s a little easier to just use the same position object for the meshes and line points, without the need to keep track of the index. :+1:
https://playground.babylonjs.com/#YEZPVT#839

Ooh, one more edit, here’s a smoother version that fixes the issue of the line not updating right away when the mesh is dragged, by updating the line in the position validator instead of using the onDrag observable. It’s a little hacky since it’s not the intended usage of the validator, but the validator fires before rendering while onDrag fires afterwards, so it seems to works better in this case IMO. :sweat_smile:
https://playground.babylonjs.com/#YEZPVT#840

4 Likes