I have created a demonstration for drawing a LineSegment
using three.js
. I have implemented vertexColors
in the material
and assigned colors to the vertices. When hovering over different parts of the LineSegment
, I change the color of the selected vertex (along with its adjacent vertices in the order they were added to the geometry.vertices
array). This way, the line changes color based on the vertex picked by the raycaster
.
You can view the example on jsfiddle: https://jsfiddle.net/sounakgarai/tedmc2f0/3/
The problem I'm facing is that the hover accuracy is not ideal; the Linesegment
changes color even when the mouse cursor is far away from it (you can observe this when you run the code). I am aiming for precise accuracy, where the color change occurs only when the cursor is directly on the LineSegment
.
Is it possible to achieve this level of accuracy?