avoid PCTW error on certain vehicles (#4463)

fix #4413
This commit is contained in:
commy2 2016-10-08 12:45:40 +02:00 committed by Glowbal
parent 4c96278bb4
commit 74dfa6ca33
2 changed files with 7 additions and 1 deletions

View File

@ -16,13 +16,17 @@ GVAR(nearUnits) = [];
// @todo. Maybe move to common?
[{
// handle RHS / bugged vehicle slots
private _camPosAGL = positionCameraToWorld [0,0,0];
if !((_camPosAGL select 0) isEqualType 0) exitWith {};
private _nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {
_nearUnits resize 10;
};
} forEach nearestObjects [positionCameraToWorld [0,0,0], ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV
} forEach nearestObjects [_camPosAGL, ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV
GVAR(nearUnits) = _nearUnits;

View File

@ -68,6 +68,8 @@ private _ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0,
private _maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance);
private _camPosAGL = positionCameraToWorld [0, 0, 0];
if !((_camPosAGL select 0) isEqualType 0) exitWith {}; // handle RHS / bugged vehicle slots
private _camPosASL = AGLtoASL _camPosAGL;
private _vecy = (AGLtoASL positionCameraToWorld [0, 0, 1]) vectorDiff _camPosASL;