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 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 model vertex.
Parameters:
vector |
Vector to be set to the vertex world position. |
entity |
Pointer to a model entity. |
number |
Number of the vertex. |
Modifies:
vector
Speed:
Medium
Remarks:
-
When the entity is animated, make sure to call ent_animate before retrieving the vertex
position.
Otherwise the vector is set to the position of the non-animated vertex.
-
For retrieving or modifying vertex positions in entity coordinates,
or for retrieving positions from non-model entities, use ent_getvertex.
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:
vec_for_normal, vec_for_min, vec_for_ent, ent_getvertex
► latest
version online