planes ignore path

Posted By: JazzDude

planes ignore path - 08/19/12 18:58

Anybody got a quick answer to why some planes follow their path but others fly around in circles? All have the same action.
Posted By: Superku

Re: planes ignore path - 08/19/12 19:24

You should have posted the code that you are using, this way it's only a guessing game: Some of your planes do not get close enough to their current path target, then they try to turn around but as the angular speed is limited, they never get the right angle and thus always fly around the current node.
Posted By: JazzDude

Re: planes ignore path - 08/19/12 20:00

Here's the action code:

Code:
action bomber_target
{
	wait(1);
	c_setminmax(my);
	my.fat=off;
	my.narrow=on;
	
	plane = me;
	
	my.transparent = on;
	my.alpha = 100;

	my.enable_shoot = on; 
	my.event = my_hit;
	
	ent_handle[my.ent_id] = handle(me);
	
	if(my.my_path==1){
		path_set(my, "path_001");	
	}
	if(my.my_path==2){
		path_set(my, "path_002");	
	}
	if(my.my_path==3){
		path_set(my, "path_003");	
	}
	if(my.my_path==4){
		path_set(my, "path_004");	
	}
	if(my.my_path==5){
		path_set(my, "path_005");	
	}
	
	path_getnode(my,my.start_node,my.temp1_posx, null);

	move_bomber();
	
	while(1)
	{
		my.path_dist = vec_dist(my.x, my.temp1_posx);  // close to node?
		
		if(my.path_dist < 85)
		{
			my.start_node = path_nextnode(my,my.skill2,1);
			if(my.start_node == 0) {
				my.start_node = 1;
			} 
			//if the last node was reached, start again with the first one
			path_getnode(my,my.start_node,my.temp1_posx, null);
			vec_to_angle(my.temp__pan,vec_diff(my.temp2_posx,my.temp1_posx,my.x));		
		}
		
		wait(1);
	}
}


Posted By: JazzDude

Re: planes ignore path - 08/19/12 20:16

the paths:


Posted By: JazzDude

Re: planes ignore path - 08/22/12 04:14

The solution was simple.

if(my.path_dist < 200)
Posted By: MasterQ32

Re: planes ignore path - 08/22/12 06:29

maybe you can do some better solution:
if(my.path_dist < my.bomber_speed * time_step)
Posted By: Superku

Re: planes ignore path - 08/22/12 23:27

MasterQ32 is right, your code could still fail on lower framerates.
Btw I still think my guess was right, the assimilation of my.pan to my.temp__pan is too slow.
© 2024 lite-C Forums