Highlight/Snap the vertex of geometry on mouse hovering


Its Amazing,
Thanks :yum:

I Have one more doubt ,
In that your code the marker ( SphereBufferGeometry )
size depend on size of .stl model.
Can we fix it for all .stl model?

I want to find distance between two highlight vertex.

You can set the radius of the marker to 1 then scale it in proportion, for example, 0.025 of the longest side of bounding box of a model.

Any explanatory picture of the desired result? Or more detailed explanation?

file5.stl (6.7 KB)
Please add this file to your code.
you will get result.

That’s how you can scale the marker in dependence of the max dimension of a model:

I used that ,i got error ,not able to solve that :expressionless:

Uncaught TypeError: tri.getBarycoord is not a function
** at setPos**
Can you suggest me?

able to solve that problem.
thanks :yum:

Can we add some geometry( box) on that highlighted a vertex after mouse click event on that point (onDocumentMouseDown)?
like this

I see no single reason why we can’t :slight_smile:
Create a box mesh, put it at some position that is surely never happen to be in the camera frustum at the beginning (kind of box.position.setScalar(10000)) then on a mouse down event just change the position of the box with copying the position of a marker: box.position.copy(marker.position);

Its Working .
Actually i want to calculate distance between two point which is got after on mouse down event on two highlights vertex at once in scene.
In my scene i loaded .stl file.
i used this ,yet not implement.

Can you suggest me?

Have a look at this topic: [SOLVED]Mesure distance between two points on a object by clicking

I have seen that topic
It work fine but i want that markers via highlighted vertex and after highlighted on mouse down event i want distance between that .
I tried it, yet stuck.
On highlighted vertex not able to add your markers.:expressionless:

Any live example of what you’ve tried?

Sorry ,On local i tried
So didn’t have codepen/live example for it.

Could you try to create one?

Trying :sweat_smile:

Not able to give Any live example.

@prisoner849 How about this?

A rough example with using of barycentric coordinates of faces of a non-indexed buffer geometry (an STL-model from examples):

What about this? Works as expected :smiley:

1 Like

@prisoner849 I love you dude


I’m working on combine these two pens of yours. I’m not real familiar with Three.js yet but is the


have anything to do with the placement of each of the spheres for the hovering and the click to get the line drawn to measure?