From 74dfa6ca33df53a9b93902100f014ea537dd2b4f Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 8 Oct 2016 12:45:40 +0200 Subject: [PATCH] avoid PCTW error on certain vehicles (#4463) fix #4413 --- addons/laserpointer/XEH_postInit.sqf | 6 +++++- addons/nametags/functions/fnc_onDraw3d.sqf | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/laserpointer/XEH_postInit.sqf b/addons/laserpointer/XEH_postInit.sqf index 219c70d372..bfc617965d 100644 --- a/addons/laserpointer/XEH_postInit.sqf +++ b/addons/laserpointer/XEH_postInit.sqf @@ -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; diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index 7f3f04a0c4..dc4b130a52 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -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;