Skip to content

Commit 679ea3f

Browse files
committed
Fixing issue causing cargo to drive on top of trees / bushes
1 parent 5ae0345 commit 679ea3f

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

addons/SA_AdvancedTowing.pbo

57 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

addons/SA_AdvancedTowing/functions/fn_advancedTowingInit.sqf

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1313
#define SA_Find_Surface_ASL_Under_Position(_object,_positionAGL,_returnSurfaceASL,_canFloat) \
1414
_objectASL = AGLToASL (_object modelToWorldVisual (getCenterOfMass _object)); \
1515
_surfaceIntersectStartASL = [_positionAGL select 0, _positionAGL select 1, (_objectASL select 2) + 1]; \
16-
_surfaceIntersectEndASL = [_positionAGL select 0, _positionAGL select 1, (_objectASL select 2) - 10]; \
17-
_surfaces = lineIntersectsSurfaces [_surfaceIntersectStartASL, _surfaceIntersectEndASL, _object, objNull, true, 2]; \
18-
_returnSurfaceASL = [_positionAGL select 0, _positionAGL select 1, 0]; \
19-
if(count _surfaces > 0) then { \
20-
if!(((_surfaces select 0) select 2) isKindOf "RopeSegment") then { \
21-
_returnSurfaceASL = (_surfaces select 0) select 0; \
16+
_surfaceIntersectEndASL = [_positionAGL select 0, _positionAGL select 1, (_objectASL select 2) - 5]; \
17+
_surfaces = lineIntersectsSurfaces [_surfaceIntersectStartASL, _surfaceIntersectEndASL, _object, objNull, true, 5]; \
18+
_returnSurfaceASL = AGLToASL _positionAGL; \
19+
{ \
20+
scopeName "surfaceLoop"; \
21+
if( isNull (_x select 2) ) then { \
22+
_returnSurfaceASL = _x select 0; \
23+
breakOut "surfaceLoop"; \
2224
} else { \
23-
if(count _surfaces > 1) then { \
24-
if!(((_surfaces select 1) select 2) isKindOf "RopeSegment") then { \
25-
_returnSurfaceASL = (_surfaces select 1) select 0; \
25+
if!((_x select 2) isKindOf "RopeSegment") then { \
26+
_objectFileName = str (_x select 2); \
27+
if((_objectFileName find " t_") == -1 && (_objectFileName find " b_") == -1) then { \
28+
_returnSurfaceASL = _x select 0; \
29+
breakOut "surfaceLoop"; \
2630
}; \
2731
}; \
2832
}; \
29-
if(_canFloat && (_returnSurfaceASL select 2) < 0) then { \
30-
_returnSurfaceASL set [2,0]; \
31-
}; \
32-
};
33+
} forEach _surfaces; \
34+
if(_canFloat && (_returnSurfaceASL select 2) < 0) then { \
35+
_returnSurfaceASL set [2,0]; \
36+
}; \
3337

3438
#define SA_Find_Surface_ASL_Under_Model(_object,_modelOffset,_returnSurfaceASL,_canFloat) \
3539
SA_Find_Surface_ASL_Under_Position(_object, (_object modelToWorldVisual _modelOffset), _returnSurfaceASL,_canFloat);

0 commit comments

Comments
 (0)