Game Version number: 1.2.0.23
Modded?: (Yes/No) No
Issue Description:
Seems that BaseRoad objects that could be returned from RoadNetworkManager.GetRoadsInAABB() call could return a lot of broken vectors (GetPoints() method of BaseRoad class) and encountering such error throws game engine validation error as soon as they appear in the script code.
Example code (coordinates are Arland main city):
private void TestRoads() { SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld()); if (!aiWorld) return; RoadNetworkManager roadNetworkManager = aiWorld.GetRoadNetworkManager(); if (!roadNetworkManager) return; //arland beauwhatever city vector position = {3165.111, 11.576, 2798.563}; float searchRadius = 500.0; vector minAABB = m_Location.GetOrigin() - { searchRadius , 0, searchRadius }; vector maxAABB = m_Location.GetOrigin() + { searchRadius , 1000, searchRadius }; array<BaseRoad> roads = {}; roadNetworkManager.GetRoadsInAABB(minAABB, maxAABB, roads); for (int i = 0; i < roads.Count(); i++) { BaseRoad road = roads[i]; array<vector> points = {}; road.GetPoints(points); for (int j = points.Count() - 1; j >= 0; j--) { ESCT_Logger.InfoFormat("Vector: %1", points[j].ToString()); } } }
Log:
log ... Vector: <-nan, 0.000000, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <0.000000, -nan, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <-nan, 0.000000, -nan> Vector: <-nan, 0.000000, -nan> Vector: <0.000000, -nan, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <0.000000, 0.000000, -nan> Vector: <0.000000, -nan, 0.000000> Vector: <-nan, 0.000000, -nan> Vector: <-nan, 0.000000, -nan> Vector: <0.000000, -nan, 0.000000> Vector: <-nan, 0.000000, 0.000000> Vector: <0.000000, -nan, 0.000000>
Also, there are some valid but strange vectors too.
These are perfectly valid and usable road points:
SCRIPT : Vector: <2634.318848, 11.583458, 3167.178711> SCRIPT : Vector: <2638.656982, 12.729107, 3160.585938> SCRIPT : Vector: <2643.492188, 13.661993, 3155.991211> SCRIPT : Vector: <2647.750000, 14.206498, 3154.105225> SCRIPT : Vector: <2655.023438, 14.869566, 3152.913818> SCRIPT : Vector: <2669.623047, 15.996788, 3152.424316> SCRIPT : Vector: <2675.383057, 16.600000, 3151.453125> SCRIPT : Vector: <2678.991943, 17.212130, 3149.640625> SCRIPT : Vector: <2682.666504, 18.235767, 3145.931641>
And there is also this thing:
SCRIPT : Vector: <0.000000, 0.000000, 37555841551815736819712.000000> SCRIPT : Vector: <0.000000, 0.000000, 0.000000> SCRIPT : Vector: <0.000000, 3869335173849772195840.000000, 0.000000>
So, I'm not sure about BI implementation and if these points are even useful at all in internal BTRlike/road network side of things, but it seems that these "extemely long value" vectors and zero vectors are not useful to be used by scripters and BaseRoad.GetPoints() method could sanitize/remove those values.