From 6fce923783595cdcf739606064fac028dd1fa7a7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 12 Oct 2016 18:44:49 -0500 Subject: [PATCH] Fix mortar changes for laser shootRay changes Ref #4478 --- .../functions/fnc_handlePlayerVehicleChanged.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf index 69a71c63ca..3f2a8c1f0d 100644 --- a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -86,10 +86,10 @@ if (_lastFireMode != -1) then { // With no ammo, distance display will be empty, but gun will still fire at wonky angle if aimed at ground private _testSeekerPosASL = AGLtoASL (positionCameraToWorld [0,0,0]); private _testSeekerDir = _testSeekerPosASL vectorFromTo (AGLtoASL (positionCameraToWorld [0,0,1])); - private _laserRange = [_testSeekerPosASL, _testSeekerDir, _mortarVeh] call EFUNC(laser,shootRay); - _laserRange params ["", ["_rayDistance", -5]]; // ToDo: move shootRay to common - TRACE_2("",_rayDistance,viewDistance); - _useRealWeaponDir = _rayDistance > viewDistance; // If we are looking at infinity (based on viewDistance) + private _testPoint = _testSeekerPosASL vectorAdd (_testSeekerDir vectorMultiply viewDistance); + if ((terrainIntersectASL [_testSeekerPosASL, _testPoint]) || {lineIntersects [_testSeekerPosASL, _testPoint]}) then { + _useRealWeaponDir = false; // If we are not looking at infinity (based on viewDistance) + }; }; if (_useRealWeaponDir) then {