how to detect what segment of polyline user clicked on


I have a polyline and I need to add new vertex when the user clicks on it.
How do I detect what segment of a polyline the user clicked on so that I can insert vertex at the correct index into positions array?

Thank you,


Hello Greg,

There isn’t currently a way to tell which part of a line you have clicked on. For this functionality, you’ll have to do something clever like make each segment it’s own entity or add an extra entity between each line point for the user to click on.