Jump to content
gc8

roadsConnectedTo bug?

Recommended Posts

Hi

I'm trying to make code that follows roads but problem I encountered is that the highway on altis (Orange road on map) is not considered connected to the smaller roads. if I call roadsConnectedTo on small road it never returns the highway segments.

 

Anyone else had this problem?

 

thx!

Share this post


Link to post
Share on other sites

some roads were always bugged in BI terrains. check for posts from ruebe - he may have shared some workarounds

  • Like 1

Share this post


Link to post
Share on other sites
58 minutes ago, gc8 said:

Hi

I'm trying to make code that follows roads but problem I encountered is that the highway on altis (Orange road on map) is not considered connected to the smaller roads. if I call roadsConnectedTo on small road it never returns the highway segments.

 

Anyone else had this problem?

 

thx!

 

As @.kju stated, results can be erratic at best with certain intersections.

From what I can recall @code34 also made some pathfinding functions, wonder if he ever ran into similar problems.

 

The easy way out would be for BI to add some script commands that use the already existing AI pathfinding, but most of us already know how that's working out, heh.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Ok thanks guys. I already made a workaround, I'm using nearRoads with roadsConnectedTo to get all the roads. Not sure if that's the best but it works fairly well

Share this post


Link to post
Share on other sites

In fact OO_pathfinding uses a custom weight function as input parameter to work cause the application field is larger than gps.

 

It can be a function relative to road, or anything you want (like tree, house, number of peoples, etc.)

 

in the default exemple, the weight function is relative to road segment size (for a gps like exemple)

private _weightfunction = {
			private ["_position", "_size", "_average", "_cost"];
			
			_position = _this select 0;
			_size = _this select 1;
			_average = 0;
			_cost = 0;

			_list = _position nearRoads _size;
			if(count _list > 0) then {
				_bbr = boundingBoxReal (_list select 0);
				_br0 = _bbr select 0;
				_br1 = _bbr select 1;
				_maxwidth = abs ((_br1 select 0) - (_br0 select 0));
				_maxlength = abs ((_br1 select 1) - (_br0 select 1));
				_average = floor (_maxwidth * _maxlength);
				if(_average > 200) then {
					_cost = 1;
				} else {
					_cost = 2;
				};
			};
			_cost;
		};

 

So it wasn't really affect by this problem. I encountered this kind of problem with segment in other cases. I used the same kind of tricks with the same commands that gc8 used :)

 

if needed, @AmauryD can perhaps help you cause he worked more specifically on gps application.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×