vec_for_mesh (VECTOR*, ENTITY*, var number)
vec_to_mesh (VECTOR*, ENTITY*, var number)
Performs realtime mesh deformation of a model or terrain entity. vec_for_mesh
sets the VECTOR to the mesh coordinates of the given vertex number; vec_to_mesh
sets the vertex to a new mesh position given by the VECTOR.
Parameters:
VECTOR* |
xyz mesh coordinate. |
ENTITY* |
Entity pointer. |
number |
Number of the mesh vertex in the MED status line. |
Modifies:
VECTOR* - set to the vertex coordinate by vec_for_mesh.
Speed:
Medium
Remarks:
-
These functions don't support map entities, sprites,
or chunked terrain, and are replaced by ent_getvertex/ent_setvertex that should be used for new projects.
- Modifying a mesh of a certain
entity affects all entities that use the same mesh.
- After deforming a mesh, ent_fixnormals() might
be necessary to adapt the shading,
and c_updatehull() might
be necessary to adapt the collision hull to the new mesh.
- The mesh coordinates
of the current frame are used. Unlike world coordinates returned by vec_for_vertex(),
mesh coordinates are relative to the model's origin without rotation or frame
interpolation.
- When
deforming terrain, only the height (z coordinate) of a mesh vertex can
be changed.
Terrain must be non-chunked.
- Mesh deformation is not
automatically saved by game_save(). If this is desired,
store the mesh coordinates in an array.
Example (lite-C):
function dent(ENTITY* ent,var num) // make a "dent" into a mesh
{
vec_for_mesh(temp,ent,num);
vec_scale(temp,0.9); // move the vertex inwards by 10%
vec_to_mesh(temp,ent,num);
you = ent;
ent_fixnormals(you,your.frame)
}
See also:
ent_vertices, ent_fixnormals,
vec_for_vertex, vec_for_normal,
vec_for_uv, vec_for_min,
vec_for_max ► latest
version online