set more then one model to follow a path

Posted By: Realspawn

set more then one model to follow a path - 10/19/15 10:55

What would be the best way to say make 4 models follow the same path but they follow it behind each other. so it looks like they follow each other on the same path laugh

thank you for your time laugh
Posted By: slacer

Re: set more then one model to follow a path - 10/19/15 15:42

Do you want them to walk along the path as a Group with a distance between each entity?

In this case I would define one entity as leader who is the one who follows the path.
The other entities should not follow the path but follow one other entity.
a-> follows -> b -> follows -> c -> follows -> d -> follows path.

If you define a minium distance to the next entity, it is possible to avoid colliding.


[EDIT]
If the distance between these objects is too large, the following entities don't stay on the path.

hope this helps a bit wink
Posted By: Anonymous

Re: set more then one model to follow a path - 10/19/15 17:39

slacer's way is very good.

If you use my find the vec for path node from my old post and the last time we talked about paths , you can

Make leader looks at node, follower A looks at Leader_node-1, follower B looks at Leader_node -2, follower C looks at Leader_Node -3.


Slacer's Way

Code:
action leader ()
{
Leader = my;
 .. .find path , follow path
} 

action follower_a() 
{
 Follower_A =my;
while(x)
{
 if(Leader.on_path == 1)
 {
   if( vec_dist(my,Leader) > 50 )
     { 
       vec_to_ang( to look at LEADER); 
       c_move(....);
      } 
   } 
wait(1);
}

action follower_b() 
{
 Follower_B =my;
while(x)
{
 if(Leader.on_path == 1)
 {
   if( vec_dist(my,Follower_A) > 50 )
     { 
       vec_to_ang( to look at Follower_A);
       c_move(....);
      } 
   } 
wait(1);
}
action follower_c() 
{
 Follower_C =my;
while(x)
{
 if(Leader.on_path == 1)
 {
   if( vec_dist(my,Follower_B) > 50 )
     { 
       vec_to_ang( to look at Follower_B); 
       c_move(....);
      } 
   } 
wait(1);
}

Posted By: Wjbender

Re: set more then one model to follow a path - 10/19/15 19:51



this is the best way , all models will follow the same path
Posted By: Realspawn

Re: set more then one model to follow a path - 10/19/15 21:50

grinnnn thx for the tips laugh i'll try them all accept the heigh heels
Posted By: Anonymous

Re: set more then one model to follow a path - 10/19/15 22:12

Code:
ENTITY* ent_glob_leader;
ENTITY* ent_glob_follower_a;
ENTITY* ent_glob_follower_b;
ENTITY* ent_glob_follower_c;
action leader()
{
VECTOR vec_next_node;
ent_glob_leader=me;
	
	path_set(my,"path_000");
	
	/////////////////////////////////////////////////////////////////////
	
	my.NODE_NEXT=path_nextnode(my,1,1); // SET THE NODE
	while(1)
	{
         // PATH NODE DETECTION AND RANDOMIZATION AND FACING //////////////////////////////////
		
		
		if(vec_dist(my.x,vec_next_node.x) < my.max_x)    
		{
                    
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on new path -- NOTE ALL PATHS MUST HAVE THE SAME NUM NODE IN SAME GEN LOCATIO	
		}
		
		path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);  // Get next node actual vector location 
		
		
			vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
		

		///////////////////////////////////////////////////////////////////////////
		
		// SOFT AND HARD MOVEMENTs /////////////////////////////////////////////////////////////
		
		c_move(my,vector(my.skill3*time_step,0,0),nullvector,GLIDE | IGNORE_PASSABLE);
		
wait(1);
}
}

action follower_a()
{
VECTOR vec_next_node;
ent_glob_follower_a=me;
	
	path_set(my,"path_000");
	
	/////////////////////////////////////////////////////////////////////
	
	my.NODE_NEXT=path_nextnode(my,ent_glob_leader.NODE_NEXT-1,1); // SET THE NODE
	while(1)
	{
         // PATH NODE DETECTION AND RANDOMIZATION AND FACING //////////////////////////////////
		
		
		if(vec_dist(my.x,vec_next_node.x) < my.max_x)    
		{
                    
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on new path -- NOTE ALL PATHS MUST HAVE THE SAME NUM NODE IN SAME GEN LOCATIO	
		}
		
		path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);  // Get next node actual vector location 
		
		
			vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
		

		///////////////////////////////////////////////////////////////////////////
		
		// SOFT AND HARD MOVEMENTs /////////////////////////////////////////////////////////////
		
		c_move(my,vector(my.skill3*time_step,0,0),nullvector,GLIDE | IGNORE_PASSABLE);
		
wait(1);
}
}

action follower_b()
{
VECTOR vec_next_node;
ent_glob_follower_b=me;
	
	path_set(my,"path_000");
	
	/////////////////////////////////////////////////////////////////////
	
	my.NODE_NEXT=path_nextnode(my,ent_glob_follower_a.NODE_NEXT-1,1); // SET THE NODE
	while(1)
	{
         // PATH NODE DETECTION AND RANDOMIZATION AND FACING //////////////////////////////////
		
		
		if(vec_dist(my.x,vec_next_node.x) < my.max_x)    
		{
                    
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on new path -- NOTE ALL PATHS MUST HAVE THE SAME NUM NODE IN SAME GEN LOCATIO	
		}
		
		path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);  // Get next node actual vector location 
		
		
			vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
		

		///////////////////////////////////////////////////////////////////////////
		
		// SOFT AND HARD MOVEMENTs /////////////////////////////////////////////////////////////
		
		c_move(my,vector(my.skill3*time_step,0,0),nullvector,GLIDE | IGNORE_PASSABLE);
		
wait(1);
}
}

action follower_c()
{
VECTOR vec_next_node;
ent_glob_follower_c=me;
	
	path_set(my,"path_000");
	
	/////////////////////////////////////////////////////////////////////
	
	my.NODE_NEXT=path_nextnode(my,ent_glob_follower_b.NODE_NEXT-1,1); // SET THE NODE
	while(1)
	{
         // PATH NODE DETECTION AND RANDOMIZATION AND FACING //////////////////////////////////
		
		
		if(vec_dist(my.x,vec_next_node.x) < my.max_x)    
		{
                    
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on new path -- NOTE ALL PATHS MUST HAVE THE SAME NUM NODE IN SAME GEN LOCATIO	
		}
		
		path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);  // Get next node actual vector location 
		
		
			vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
		

		///////////////////////////////////////////////////////////////////////////
		
		// SOFT AND HARD MOVEMENTs /////////////////////////////////////////////////////////////
		
		c_move(my,vector(my.skill3*time_step,0,0),nullvector,GLIDE | IGNORE_PASSABLE);
		
wait(1);
}
}




Man I hope this works --- it's the right idea, but may have issue - I can't test it.

Possible issues in the my.NODE_NEXT=path_nextnode(......); of the followers.

Possible need for a while(!ent_glob_leader){wait(1);}

EDIT - one more possible - possible need for
while(ent_glob_leader.NODE_NEXT <2){ wait(1);}
while(ent_glob_follower_a.NODE_NEXT <2){ wait(1);}
while(ent_glob_follower_b.NODE_NEXT <2){ wait(1);}


any ways have fun
Mal
© 2024 lite-C Forums