yes as nitro said, u need to compute the normal at the point where your entity is resting his foot. using the direction of this normal, u need to orient ur entity towards it.
ur ground normal is given by the vector "normal"
this is a lite-c snippet maybe can convert to c-script (sorry am not too familiar with c-script).
function place_me_on_ground
{
vec_set(temp, my.x);
temp.z -= 1000; // 1000 Quants down
c_trace(my.x, temp, IGNORE_ME);
vec_set(my.x, target); // put on surface
vec_to_angle(my.pan, normal); // look upwards
}
since we dont have a vec_to_normal, the above uses the c_trace to get the angle.