Draw straight line on a Mesh using `attributes.color`

I have a complicated Mesh produced by plotting points in space. I want to draw a straight line on a certain height on my mesh, but when I try my line comes out broken. Are there additional parameters I can target when deciding which coordinates should be painted for line to appear straight?

Additionally when I use Points instead of Mesh for the same BufferGeometry, the line comes out exactly as I need it.



The algorithm I use to find points is essentially this:

  for (let i = 0; i < position.length; i += 3) {
    if (position[i] === targetCoordinate) {
      color[i] = 1
      color[i + 1] = 1
      color[i + 2] = 1

Some additional info on my shape, if needed, can be found in this thread.

Reminded me about this somehow: Draw a horizontal line around object on Mouse Hover - #2 by prisoner849

1 Like

Thank you for your reply! Your example looks like exactly what I need! I will study it and come back with results