Skip to content

Instantly share code, notes, and snippets.

@Benargee
Last active April 13, 2020 02:38
Show Gist options
  • Save Benargee/715c7253fc8fa9bed8978d2b085b71e4 to your computer and use it in GitHub Desktop.
Save Benargee/715c7253fc8fa9bed8978d2b085b71e4 to your computer and use it in GitHub Desktop.
Draw lineIntersectsSurfaces point Arma 3
_unit = player;
originPos = eyePos _unit;
offsetVector = _unit weaponDirection (currentWeapon _unit);
offsetPos = offsetVector vectorMultiply 10;
destPos = originPos vectorAdd offsetPos;
intersections = lineIntersectsSurfaces [originPos, destPos, _unit, objNull, true, 1];
if (count intersections > 0) then {
//found
intersectPos = intersections select 0 select 0;
drawLoop = {
drawLine3D [ASLToAGL originPos, ASLToAGL destPos, [0,1,0,1]];
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,1,0,1], ASLToAGL intersectPos, 1, 1, 0, (str (intersections select 0 select 2)), 0, 0.03, "TahomaB"];
};
} else {
//not found
drawLoop = {
drawLine3D [ASLToAGL originPos, ASLToAGL destPos, [1,0,0,1]];
};
};
onEachFrame {
call drawLoop;
};
hintSilent str intersections;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment