Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How can I achieve accuracy of raycaster while mouse hover on different pieces of a LineSegment?

Sounak Garai:

I have created one example to draw a LineSegment in three.js. I have applied vertexColors to its material and pushed color for vertices. Now when I hover on all the different pieces of the LineSegment I change the color of that vertex (along with the next or previous vertex depending on the order it got pushed in the geometry.vertices array so that a line gets its color changed, you will understand once you see the code) that gets picked by the raycaster.

The jsfiddle link is here. https://jsfiddle.net/sounakgarai/tedmc2f0/3/

Now the issue is that the hovering is not accurate; a piece of the Linesegment gets its color changed even when the mouse cursor is in a far distance from it (you will be able to see it when you run it). I would like to see the accuracy in this case. The piece of LineSegment should change the color when the mouse cursor is accurately on it.

Is this achievable?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How can I achieve accuracy of raycaster while mouse hover on different pieces of a LineSegment?

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×