Hi everyone, there's a way to set the origin of an entity to ground?
I tried this way of metalicross:
PHP Code:
stock GetUserEyePosition(iId, Float:vecReturn[3], Float:fNormalDist) // mia gordo mia :3
{
static Float:vecStart[3], Float:vecEnd[3]
entity_get_vector(iId, EV_VEC_origin, vecStart)
entity_get_vector(iId, EV_VEC_view_ofs, vecEnd)
xs_vec_add(vecStart, vecEnd, vecEnd) // vista de los ojos
entity_get_vector(iId, EV_VEC_v_angle, vecEnd)
engfunc(EngFunc_MakeVectors, vecEnd)
get_global_vector(GL_v_forward, vecEnd)
xs_vec_mul_scalar(vecEnd, 9999.9, vecEnd)
xs_vec_add(vecStart, vecEnd, vecEnd) // vista a la mierda de los ojos
engfunc(EngFunc_TraceLine, vecStart, vecEnd, DONT_IGNORE_MONSTERS, iId, 0)
get_tr2(0, TR_vecPlaneNormal, vecEnd)
xs_vec_mul_scalar(vecEnd, fNormalDist, vecEnd) // distancia de la normal de la superficie
get_tr2(0, TR_vecEndPos, vecReturn)
xs_vec_add(vecReturn, vecEnd, vecReturn)
}
Works, but I want to restrict that for only aiming the ground; and in the case that is aiming the ground always set the origin in Z coordenate = 0 (in other words, "set to ground")
__________________