Advertisement
cctv

crosshair thing 2.0

Jan 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.31 KB | None | 0 0
  1. _crosshair = addMissionEventHandler ["draw3D",{
  2. _arXhair = positionCameraToWorld [0, 0, 20];
  3. if (alive player) then {
  4.     if (!(isNull cursorObject) && (cursorObject distance player < 10)) then
  5.     {
  6.         _posXhair = AGLToASL (player modelToWorld (player selectionPosition "Weapon"));
  7.  
  8.         //Create the three axes from the player character model weapon memory point
  9.         _right = _posXhair vectorFromTo AGLToASL (player modelToWorld (player selectionPosition "righthand"));
  10.         _forward = player weaponDirection currentWeapon player;
  11.         _up = _right vectorCrossProduct _forward;
  12.         _right = _forward vectorCrossProduct _up;
  13.  
  14.         //Offset the laser start position using the three axes created above
  15.         _posLaser = _posXhair;
  16.         {
  17.             _posLaser = _posLaser vectorAdd (_x vectorMultiply ([0.67, 0.77, 0.035] select _forEachIndex));
  18.         }
  19.         forEach [_right, _forward, _up];
  20.  
  21.         //Find the laser end position by using a 5000m line intersect check
  22.         _posXhair = _posLaser vectorAdd (_forward vectorMultiply 20);
  23.         _hitLaser = lineIntersectsSurfaces [_posLaser, _posXhair, player];
  24.         if (0 < count _hitLaser) then
  25.         {
  26.             _arXhair = ASLToAGL ((_hitLaser select 0) select 0);
  27.         }
  28.         else
  29.         {
  30.             _arXhair = ASLToAGL _posXhair;
  31.         };
  32.         drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectOver_ca.paa", [1, 1, 1, 0.4], _arXhair, 1, 1, 0];
  33.     };
  34. };
  35. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement