vec_lerp(
  
VECTOR* v,VECTOR* v1,VECTOR* v2,var f);
interpolates the vector v between v1 and v2 according to the factor f.
Parameters:
  
    | v | 
    
      
    VECTOR, ANGLE, or COLOR  to interpolate between v1 and v2 | 
  
  
    | v1 | 
    first vector | 
  
  
    | v2 | 
    second vector | 
  
  
    | f | 
    interpolation factor | 
  
 
Modifies:
  
v - will be interpolated between v1 and v2 according to the factor f
Speed:
Fast
Algorithm:
v = (1-f)*v1 + f*v2
Example (lite-C):
		
// the following command sets the position vector at halfway between my and you
vec_lerp(position,my.x,you.x,0.5); 
// the following function interpolates a position, color, or angle to a target value during a time interval t
function time_lerp(var* v,var* vtarget,var time)
{
   wait(1);        // put the function in the scheduler for being identified by proc_kill
   if (NULL != me)
     proc_kill(5); // terminate previous time_lerp calls of the current entity
   var vstart[3];
   vec_set(vstart,v);   
   var t;
   if (time > 0)
     for(t=time_frame; t < time; t += time_frame) {
       vec_lerp(v,vstart,vtarget,t/time);
       wait(1);
     } 
   vec_set(v,vtarget);
}
See also:
		
vec_scale
► latest
version online