no problem:
var angle[3];
c_trace(my.x, vector(0,0,my.z-1000), USE_BOX);
vec_to_angle(vector(angle[0],angle[1],angle[2]), normal);
set(my.x, vector(target.x, target.y, target.z+my.min_z*cos(angle[2])));
my.pan = angle[0];
my.tilt= angle[1];

should work but not tested - sorry for that.