Here is example of code that you need: http://www.gstools.de/aum/aum82/questions_from_the_forum.htm

function avoid_obstacles()
Code:
function avoid_obstacles()

{

       vec_set (temporary_distance.x, camera.x);

       temporary_distance.z -= 50; // sets a position closer to the feet of the player; 50 = experimental value

       distance_traced = c_trace (player.x, temporary_distance.x, IGNORE_ME | IGNORE_PASSABLE); // trace between the player and temporary_distance

       if (distance_traced == 0) // no obstacles on the way?

       {

               my.alpha = minv(100, my.alpha + 3 * time_step); // then increase player's alpha up to 100

               if (player.alpha == 100) 

               {

                       reset(player, TRANSLUCENT);

               }

               else 

               {

                       set(player, TRANSLUCENT);

               }

               if (camera_distance < my.skill40) // if the camera got closer to the player

               {

                       camera_distance += 1; // restore the initial camera_distance slowly

               }

       } 

       else // obstacles encountered?

       {

               distance_traced -= 2; // then bring the camera 2 quants closer to the player!

               my.alpha = (distance_traced / (my.skill40 + 1)) * 100; // decrease player's alpha; don't allow a division by zero

               camera.x = player.x - distance_traced * cos(camera.pan); // place the camera behind the player

               camera.y = player.y - distance_traced * sin(camera.pan); // at the new distance given by distance_traced

       }

}




1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro