Code:

var cam_height = 350;

VECTOR temp_ground;
VECTOR temp_cam;

vec_zero(temp_ground);
vec_zero(temp_cam);

temp_cam.x = camera.x;
temp_cam.y = camera.y;

vec_set(temp_ground, temp_cam.x);

temp_ground.z -= 10000;

trace_mode = IGNORE_ME + IGNORE_PASSABLE;

temp_ground.z = c_trace(temp_cam.x,temp_ground,trace_mode);

if((temp_ground.z + cam_height) != camera.z)
{
if(camera.z < (temp_ground.z + cam_height))
{
camera.z += (5 * time_step);
if(camera.z > (temp_ground.z + cam_height))
camera.z = temp_ground.z + cam_height;
}

else
{
camera.z -= (5 * time_step);

if(camera.z < (temp_ground.z + cam_height))
camera.z = temp_ground.z + cam_height;

}
}



It works

Thanks for your idea!!


Michael Bartman A6/A7 Commercial Edition Programmer By Nature