|
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
Expert
|
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
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
|
Malice
Unregistered
|
Malice
Unregistered
|
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
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: Realspawn]
#455440
10/19/15 22:12
10/19/15 22:12
|
Malice
Unregistered
|
Malice
Unregistered
|
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.
|
|
|
|