
Then I add points randomly.
But now the added points have different IDs

For example, if I select point zero.
How could I get the next point by following the curve until I reach point 1 ?
in the order 0,5,3,4,2,1

I tried the code : M_Mesh:ClosestPoint() but it didn't work, is there any way to do that?
What I want to achieve is that if for example there are many shapes; and the user selects a group of points, to get the next ones in order following the curve.
Code: Select all
local count = 0
local PuntosSel = {}
for i=0, mesh:CountPoints()-1 do
local point = mesh:Point(i)
if point.fSelected then
Pos = point.fPos
break
end
end
mesh:SelectConnected()
for i=0,mesh:CountPoints()-1 do
local point = mesh:Point(i)
if point.fSelected then
count = count+1
end
end
local ignore = -1
for i=1,count do
local puntoID = mesh:ClosestPoint(Pos,ignore)
ignore = puntoID
table.insert(PuntosSel,puntoID)
end
for k,v in ipairs(PuntosSel) do
print(v)
end