Get line path points coordinates

When creating a line there is an option to specify the path points:

let Line = new BABYLON.MeshBuilder.CreateLines(null, { points:[ ... ] })

How can I access the path points again? I can’t find anything like that in the API docs :thinking:

Usually you have your points in array like here:

More info also here -

Yes, but how can I access them back from within the Line instance? Pseudo:

let Line = new B.MeshBuilder.CreateLines(...)

console.log(Line.points) // this doesn't work

You could only access the created data e.g. vertices data: Updating Vertices | Babylon.js Documentation

If you need to keep track of your line data, you could attach them to the mesh through js.

1 Like

Here it is -

var positions = lines.getVerticesData(BABYLON.VertexBuffer.PositionKind);

Since every mesh is an object, you can add nececcary properties to it when needed and get them later directly.

1 Like