Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 595 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
set more then one model to follow a path #455406
10/19/15 10:55
10/19/15 10:55
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
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


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: set more then one model to follow a path [Re: Realspawn] #455420
10/19/15 15:42
10/19/15 15:42
Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
slacer Offline
Expert
slacer  Offline
Expert

Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
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

Last edited by slacer; 10/19/15 15:50.
Re: set more then one model to follow a path [Re: slacer] #455425
10/19/15 17:39
10/19/15 17:39

M
Malice
Unregistered
Malice
Unregistered
M



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);
}


Re: set more then one model to follow a path [Re: ] #455432
10/19/15 19:51
10/19/15 19:51
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace


this is the best way , all models will follow the same path


Compulsive compiler
Re: set more then one model to follow a path [Re: Wjbender] #455438
10/19/15 21:50
10/19/15 21:50
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
grinnnn thx for the tips laugh i'll try them all accept the heigh heels


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: set more then one model to follow a path [Re: Realspawn] #455440
10/19/15 22:12
10/19/15 22:12

M
Malice
Unregistered
Malice
Unregistered
M



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

Last edited by Malice; 10/19/15 22:20.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1