Jump to content
Sign in to follow this  
ffredyk

Finding road segments positions

Recommended Posts

I don't really have time for depackanging whole BIS game just to find how all the road classes are named. Can someone point me or show me some easy way on how to get them?

I am making little racing court, but without navigation it's lacking main aspect of entertainment. I would like to experiment with displaying 3D icon symbol of road in the 50m front cone of player so he can see what is gonna f* him up behind the horizont.

All I need is some easy way or guidance on how to get the classes of roads. I will figure the rest. Thanks for any help.

Share this post


Link to post
Share on other sites

One more question to that.

If I would like to find a road(segment) that is minimum 200m away from my point and maximum 250m I have to make two full searches, one with 200m radius and one with 250m radius and then subtract the results from each other, so that just these between 200 and 250 are left?

Or I search for a segment and make _x distance _road and search as long as I found a segment that is at least 200m away?

Any better and probably faster idea ho to achieve that?

Share this post


Link to post
Share on other sites

I would say that substracting two arrays would be faster process than computing distance between two vectors multiple times. Try using

https://community.bistudio.com/wiki/BIS_fnc_codePerformance

Compare these two:

["

_array250 = player nearRoads 250;

_array200 = player nearRoads 200;

_arrayFinal = _array250 - _array200;

"] call BIS_fnc_codePerformance;

["

_array250 = player nearRoads 250;

_arrayFinal = [];

{

if(_x distance player > 200) then {_arrayFinal = _arrayFinal + [_x]}

} forEach _array250;

"] call BIS_fnc_codePerformance;

EDIT: Surprise :confused:

First code: ENUzIqSUUC9bgviMsqMDNRfkB5FokBPWIsmV7YUyw6k

Second code: qzW9LrOcTeUFnOk92e-dOKy_gILDj7WjbbyaXieDV4M

Edited by ffredyk

Share this post


Link to post
Share on other sites

Could make the second a bit faster even with count and distanceSqr and using pushBack opposed to "arr = arr + x" (if it's all necessary).

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
Sign in to follow this  

×