Quote:
You could try to offset the hit position by the negative terrain creation position (terrain.xyz may always be 000, not sure but take care) and grab the closest vertex after that.


yes sure.

I think the
Code:
vec_for_ent(hit.x,you);  // change world - entity coords

should handle this shiftet position of the terrain.

And it works with that like it should but not at the first shot.

Something must happen after the first fail contact.
c.z leads to the same result.

its
Code:
ent_nextvertex(you,hit.x);

that delivers the false vertex number at first shot.

I reduced the code and load an example up... one moment


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)