But everytime I execute it it says the same value (0.2598074), regardless of where the point is. I’ve checked to see if the vertices values are wrong but no, TransformPoint does give their exact position in the world space.

So, if the point is always the same and the vertices are not in the same position, how is it that it always says the same value?

Extremely unlikely that the Distance method is the problem. Hard to tell what the actual problem is without any other code. Did you verify that the point is always the same? Have you tried printing both the values out, and manually getting the distance between the two values?

Yes, I changed the debug contents with both the vertices positions and the point and they both were correct (the point was always the one I put and the vertices were not all the same)

The mesh im taking the vertices from is a cube, so the vertices I obtain are 8 groups 3 repeated positions, just like what a cube’s mesh should be.

The rest of the code was just me checking if the point given is 1 unit near at least one of the vertices, but for some reason vector3.Distance always gives me the same output.

No, I’ll try it out once I get home.
Although what I don’t understand is why vector3.Distance doesn’t work when it should work normally when given two vector3.

While I can’t confirm anything, when I put just Debug.Log(transform.TransformPoint(mesh.vertices)) it gives me the 24 world positions of the vertices of the cube, meaning that this part should be working accordingly.

Is it maybe because the script is inside the gameobject of the point? So transform.TransformPoint actually centers the vertices around the point, making the distance equal on all vertices?

Avoid just printing single values to the console, especially when you log mutliple values. Always write a proper log message so you can actually identify the message where it came from.

The distance you read sounds like the distance from the corners of the cube to the center of the cube assuming the cube has a side length of 0.3 (so half the side would be 0.15). So if your “pDamage” position is the center of the cube, all vertices would have the same distance from the center.

So to check this, as I said, use a proper log statement like

var p = transform.TransformPoint(mesh.vertices[i]);
Debug.Log("#"+i + " dist from "+pDamage.ToString("0.000")
" to " + p.ToString("0.000") + " is " + Vector3.Distance(pDamage, p), gameObject);

Try this and copy the log messages here. You can manually verify the distances of each message since we print out the positions for each point. You can copy the messages either from the bottom half of the console window or from the editor log file.