vec_for_vertex (VECTOR* vector, ENTITY* entity, var number)

Sets the given vector to the current absolute xyz world position of the vertex with given number of the given model or terrain entity. The vertex number is indicated in the MED status line when selecting a vertex. This function is useful for attaching weapons, particle effects or other elements to a certain vertex.

Parameters:

vector vector to be set to the vertex position
entity Pointer to Entity
number Number of Vertex

Modifies:

vector

Speed:

Medium

Example (lite-C):

function find_close_vertex(ENTITY* ent,VECTOR* vHit)
{
 	var i;
  for (i = ent_vertices(ent); i > 0; i--) // repeat until all vertices are checked
 	{
    VECTOR v;
 	  vec_for_vertex(v, ent, i);
 	  if (vec_dist(vHit,v) < 10)
      break; 
  }
 	return(i); // return first vertex number closer than 10 units to vHit
} 

See also:

ent_vertices, vec_for_normal, vec_for_mesh, vec_for_min, vec_for_ent

► latest version online