c_setminmax(terrain_entity);
wait(1);
c_updatehull(terrain_entity,0);
// c_updatehull(terrain_entity,my.frame);
wait(3);
for (i=1; i<=(var)(ent_status(terrain_entity,0)); i++)
{
CONTACT* c = ent_getvertex(terrain_entity,NULL,i); // vertex number begins with 1 !
c_trace( vector((var)c.v.x,(var)c.v.z,vgroundmax.z+500), vector((var)c.v.x,(var)c.v.z,vgroundmin.z-500), IGNORE_ME | IGNORE_SPRITES | IGNORE_MODELS | IGNORE_MAPS | IGNORE_PASSABLE );
if (HIT_TARGET)
{
// normal
// c.v.nx = (float)normal.x;
// c.v.nz = (float)normal.y;
// c.v.ny = (float)normal.z;
// or the same with hit
c.v.nx = (float)hit.nx;
c.v.nz = (float)hit.ny;
c.v.ny = (float)hit.nz;
ent_setvertex(terrain_entity,c,i);
// or more precisely it should be the average of normals of all neighbouring faceces !!!
// it is stored in hmp in an approximated value of 162 stored normal vectors !!!
}
}