This is something I threw together quickly. It traces behind and to the sides of an object, relative to it's pan. I used a similar code to draw my player's axis for debug purposes.


Note :
-you will need a temporary vector "temp_vec" defined somewhere.
-trace_dist is how far away from the object the trace will scan.
-The result will be 0 unless you are near something (like my screenshot below I had walls to all sides of the object).
-I used the z value of " my.z + my.min_z + 1 ", which is the base of the object's collision hull + 1 (upward), the + 1 will keep the trace above ground level (hopefully).

Code:
var trace_dist = 100 // distance of trace

///////////////

   //trace behind
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan)),  my.y-(trace_dist*sin(my.pan)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE
   

   //trace left
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan-90)),  my.y-(trace_dist*sin(my.pan-90)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE LEFT
   

   //trace right
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan+90)),  my.y-(trace_dist*sin(my.pan+90)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE



same code, with added code to draw lines.
Code:
var trace_dist = 100 // distance of trace

///////////////

      //trace behind
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan)),  my.y-(trace_dist*sin(my.pan)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE
   
					// draw line green
					   vec_set(temp_vec, vector(my.x-(result*cos(my.pan)),  my.y-(result*sin(my.pan)), my.z+my.min_z+1) );
					   draw_line3d(my.x,COLOR_GREEN,0);  
					   draw_line3d(vector(my.x,my.y,my.z+my.min_z),COLOR_GREEN,100);
					   draw_line3d(temp_vec,COLOR_GREEN,100);
					   draw_line3d(temp_vec,COLOR_GREEN,0);
					//
   //trace left
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan-90)),  my.y-(trace_dist*sin(my.pan-90)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE LEFT
   
					//   draw line red
					   vec_set(temp_vec, vector(my.x-(result*cos(my.pan-90)),  my.y-(result*sin(my.pan-90)), my.z+my.min_z+1) );
					   draw_line3d(my.x,COLOR_RED,0);
					   draw_line3d(vector(my.x,my.y,my.z+my.min_z),COLOR_RED,100);
					   draw_line3d(temp_vec,COLOR_RED,100); 
					   draw_line3d(temp_vec,COLOR_RED,0);  
					//
   //trace right
   vec_set(temp_vec, vector(my.x-(trace_dist*cos(my.pan+90)),  my.y-(trace_dist*sin(my.pan+90)), my.z+my.min_z+1) );
   c_trace(vector(my.x,my.y,my.z + my.min_z+1),temp_vec, IGNORE_ME | IGNORE_PASSABLE); //TRACE
   
					//draw line blue
					   vec_set(temp_vec, vector(my.x-(result*cos(my.pan+90)),  my.y-(result*sin(my.pan+90)), my.z+my.min_z+1) );
					   draw_line3d(vector(my.x,my.y,my.z+my.min_z),COLOR_BLUE,0);   
					   draw_line3d(vector(my.x,my.y,my.z+my.min_z),COLOR_BLUE,100);
					   draw_line3d(temp_vec,COLOR_BLUE,100);   
					   draw_line3d(temp_vec,COLOR_BLUE,0); 
					//







Last edited by Rich; 06/13/10 23:43.

A8 com / A7 free