Эта функция с точностью 1° вычисляет четыре реальных угла здания, не те, которые вычисляет boundinBoxReal:
PC_fn_get_four_building_corners_ASL =
{
params ["_building"];
_boundingBoxReal = boundingBoxReal _building;
_hypotenuse = sqrt (((_boundingBoxReal select 1 select 0)^2)+((_boundingBoxReal select 1 select 1)^2));
//_angle = atan ((_boundingBoxReal select 1 select 1)/(_boundingBoxReal select 1 select 0));
_center = [((getPosASL _building) select 0),((getPosASL _building) select 1),((getPosASL _building) select 2)+0.1];
/// Вычисление четырех углов:
_all_distances_and_positions1 = [];
{
_intersect_array = lineIntersectsSurfaces [ATLToASL (_building getRelPos [_hypotenuse,_x]),_center, player, objNull, true, 1, "VIEW", "FIRE", true];
_position = _intersect_array select 0 select 0;
_distance = _center distance2D _position;
_all_distances_and_positions1 = _all_distances_and_positions1 + [[_distance,_position]];
} forEach [22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67];
_all_distances_and_positions1 sort false;
_corner_1 = _all_distances_and_positions1 select 0 select 1; /// Первый угол
_all_distances_and_positions2 = [];
{
_intersect_array = lineIntersectsSurfaces [ATLToASL (_building getRelPos [_hypotenuse,_x]),_center, player, objNull, true, 1, "VIEW", "FIRE", true];
_position = _intersect_array select 0 select 0;
_distance = _center distance2D _position;
_all_distances_and_positions2 = _all_distances_and_positions2 + [[_distance,_position]];
} forEach ([22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67] apply {_x + 90});
_all_distances_and_positions2 sort false;
_corner_2 = _all_distances_and_positions2 select 0 select 1; /// Второй угол
_all_distances_and_positions3 = [];
{
_intersect_array = lineIntersectsSurfaces [ATLToASL (_building getRelPos [_hypotenuse,_x]),_center, player, objNull, true, 1, "VIEW", "FIRE", true];
_position = _intersect_array select 0 select 0;
_distance = _center distance2D _position;
_all_distances_and_positions3 = _all_distances_and_positions3 + [[_distance,_position]];
} forEach ([22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67] apply {_x + 180});
_all_distances_and_positions3 sort false;
_corner_3 = _all_distances_and_positions3 select 0 select 1; /// Третий угол
_all_distances_and_positions4 = [];
{
_intersect_array = lineIntersectsSurfaces [ATLToASL (_building getRelPos [_hypotenuse,_x]),_center, player, objNull, true, 1, "VIEW", "FIRE", true];
_position = _intersect_array select 0 select 0;
_distance = _center distance2D _position;
_all_distances_and_positions4 = _all_distances_and_positions4 + [[_distance,_position]];
} forEach ([22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67] apply {_x + 270});
_all_distances_and_positions4 sort false;
_corner_4 = _all_distances_and_positions4 select 0 select 1; /// Четвертый угол
//{createVehicle ["VR_3DSelector_01_exit_F", ASLToATL _x, [], 0, "CAN_COLLIDE"]} forEach [_corner_1, _corner_2, _corner_3, _corner_4];
/// Возвращение массива с углами в формате ASL:
[_corner_1,_corner_2,_corner_3,_corner_4];
};
[_building] call PC_fn_get_four_building_corners_ASL;











