Drawing 2d line from a point on an object!

Hi,

I want to click on a specific point on an object(sphere) then object moves and draw a line from that point clicked.

How can i get that point coordinate and draw a line?

So thanks.

var mesh : Mesh = GetComponent(MeshFilter).mesh;
var vertices : Vector3[] = mesh.vertices;

vertices is an array, so you can index into that to get specific points.

You could use a Raycast to get the hit point on the surface. I'm not sure what point that will give, my assumption is it would be an interpolated point on a face of the surface. If that's ok, then just you that hit point. Otherwise, you'd compare that point to all the vertices in that array to find the closest one.

To draw lines, you may want to just go get Vectrosity from the Asset Store (it's free I think) or you can muck with the GS stuff.