path_create(ENTITY* entity, var nodes, var edges)

Creates an actor path with the given number of nodes and edges, and attaches the given entity to it.

Parameters:

entity - entity pointer
nodes - number of path nodes
edges - number of path edges

Returns:

0 if the path could not be created, otherwise nonzero.

Speed:

Slow

Modifies:

entity - is attached to the path.

Remarks:

Example:

// create a path from 4 points, and let a sphere follow it
void main()
{  
	max_paths = 1;
  level_load(0);
  me = ent_create(SPHERE_MDL,NULL,NULL);
  vec_scale(my.scale_x,5);
  vec_set(my.blue,vector(0,255,255));
  my.flags |= LIGHT;

  path_create(me,4,4);
  path_setnode(me,1,vector(500,250,-100),NULL);
  path_setnode(me,2,vector(500,-250,-100),NULL);
  path_setnode(me,3,vector(1000,-250,100),NULL);
  path_setnode(me,4,vector(1000,250,100),NULL);
  
  var distance = 0;
  while(1){
    path_spline(me,my.x,distance += 20*time_step);
    wait(1);
  }
}

See also:

path_scan, path_next, path_setnode, path_setedge, path_spline, num_paths, max_paths

► latest version online