Updating vertex position of instanced line mesh

Hello,

I need to create many line meshes with different vertex positions and would like to instance them if possible. I am having trouble setting the vertex buffer to set the vertex position per line mesh. Is it possible to set the vertex buffer so that each line mesh has a different set of vertex positions (two vertices per line mesh)?

Here is the playground im working in: https://playground.babylonjs.com/#MZ7QRG#3420

edit: I know line system is an option that can work for this but these lines have to update frequently so it might not be the best option for my use case so I wanted to explore this option as well.

Thank you!

Hello! The line system is drawn as one single mesh in a single draw call just like instances, so the latter don’t have a benefit in this case.

The disadvantage of a line system for my use case is I want to be able to change the isVisible property for individual lines dynamically. being able to use instanced lines would make this a little less cumbersome, but I guess the work around with a line system is just redrawing the line system with the invisible lines removed or maybe updating the vertex color array but that is a little more cumbersome. I will try it out but suggestions welcome!