lineSystem equivalent for line2D

I’m trying to expand the line2D function so that it can use an array of lines like lineSystem. Any help would be greatly appreciated.

It’s implementation might look like this:

var path1= [
	[ 	new BABYLON.Vector3(0, 0, 10),
		new BABYLON.Vector3(10, 0, 10)
	],
	[	new BABYLON.Vector3(10, 0, 0),
		new BABYLON.Vector3(10, 10, 0),
		new BABYLON.Vector3(0, 10, 0)
	]
];

var line = line2D(“line”, {path: path1, width:1.5}, scene);
line.material = new BABYLON.StandardMaterial("", scene);

Thanks.

Since your first line is in XY plane the first task would be to combine the two different line2D functions into one along with a parameter to set which plane you want the line in.

Alternatively just use the line2D function for the XY plane and rotate as needed.

Something like this https://www.babylonjs-playground.com/#FA2H7X#20

1 Like

Wow thank you so much! I’ve never seen the MergeMeshes function before. Your solution is exactly what I was looking for to “pick the pen up off the canvas and pit it down again” as it iterates through the multidimensional path array.

Best community ever! :grinning:

It would be helpful if this MultiLines2D function for non-contiguous lines could be added to the documentation at:

Line2D of Given Width