Difference between revisions of "drawLaser"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
(Syntax change)
Line 10: Line 10:
  
 
|descr= Draws a laserbeam and a lightpoint at the impact location of the laser.<br>
 
|descr= Draws a laserbeam and a lightpoint at the impact location of the laser.<br>
The command has to be executed each frame - see {{HashLink|Arma 3: Mission Event Handlers#Draw3D}}.<br>
+
This command has to be executed every frame - see {{HashLink|Arma 3: Mission Event Handlers#Draw3D}}.<br>
Lasers drawn with this command are subject to the same limitations as weapon attachment lasers as set in the <tt>CfgIRLaserSettings</tt> config class.
+
Lasers drawn with this command are subject to the same limitations as weapon attachment lasers. These limitations are defined in the <tt>CfgIRLaserSettings</tt> config class.
  
 
|gr1= Interaction
 
|gr1= Interaction
Line 17: Line 17:
 
|gr2= Lights
 
|gr2= Lights
  
|s1= [[drawLaser]] [sourcePos, direction, color, thickness, dotSize, isIR]
+
|s1= [[drawLaser]] [position, direction, beamColor, dotColor, dotSize, beamThickness, beamMaxLength, isIR]
  
|p1= sourcePos: [[Array]] format [[PositionASL]] - laser origin position
+
|p1= position: [[PositionASL]] - the laser's origin position
  
|p2= direction: [[Array]] format [[Vector3D]] - laser's direction vector
+
|p2= direction: [[Array]] format [[Vector3D]] - the laser's direction vector
  
|p3= color: [[Array]] format [[Color|Color (RGB)]] - laser beam and impact dot colour. Values can go way above the usual 0..1 range as they also act as emissivity brightness
+
|p3= beamColor: [[Array]] format [[Color|Color (RGB)]] - laser beam color. The values can go way above the usual 0..1 range as they also act as emissivity brightness
  
|p4= thickness: [[Number]] - laser beam thickness scale; if set to 0, the beam will not render
+
|p4= dotColor: [[Array]] format [[Color|Color (RGB)]] - impact dot color. Set to {{ic|[]}} to use the same value as ''beamColor''.
  
 
|p5= dotSize: [[Number]] - impact dot size; if set to 0 the impact dot will not render
 
|p5= dotSize: [[Number]] - impact dot size; if set to 0 the impact dot will not render
  
|p6= isIR: [[Boolean]] - (Optional, default [[true]]) whether the laser and impact dot are visible only in Night Vision/Thermal Imaging  
+
|p6= beamThickness: [[Number]] - laser beam thickness scale; if set to 0, the beam will not render
 +
 
 +
|p7= beamMaxLength (Optional, default: -1): [[Number]] - the maximum length of the laser beam. Special values:
 +
* '''-1:''' No limit other than that defined in <tt>CfgIRLaserSettings</tt>
 +
* '''0:''' The [[drawLaser]] command is ignored
 +
The maximum length of laser beams defined in <tt>CfgIRLaserSettings</tt> can not be exceeded, not even by setting this parameter to -1.
 +
 
 +
|p8= isIR (Optional, default: [[true]]): [[Boolean]] - whether the laser and impact dot are only visible with Night Vision / Thermal Imaging
  
 
|r1= [[Nothing]]
 
|r1= [[Nothing]]
  
|x1= <code>[[addMissionEventHandler]] ["Draw3D", {
+
|x1= Give the player a laser eye:
 +
<code>[[addMissionEventHandler]] ["Draw3D", {
 
[[drawLaser]] [
 
[[drawLaser]] [
[[eyePos]] [[player]] [[vectorAdd]] [0,0,0.1],
+
[[eyePos]] [[player]] [[vectorAdd]] [0, 0, 0.1],
 
[[getCameraViewDirection]] [[player]],
 
[[getCameraViewDirection]] [[player]],
[1000,0,0], {{cc|bright red}}
+
[1000, 0, 0], {{cc|Bright red}}
 +
[],
 +
5,
 
20,
 
20,
5,
+
-1,
 
[[false]]
 
[[false]]
 
];
 
];
}]; {{cc|give player a laser eye}}</code>
+
}];</code>
  
 
|seealso= [[drawIcon3D]] [[drawLine3D]] {{HashLink|Arma 3: Mission Event Handlers#Draw3D}}
 
|seealso= [[drawIcon3D]] [[drawLine3D]] {{HashLink|Arma 3: Mission Event Handlers#Draw3D}}
 
}}
 
}}

Revision as of 16:39, 24 September 2021

Hover & click on the images for description
Only available in Development branch(es) until its release with Arma 3 patch v2.08.

Description

Description:
Draws a laserbeam and a lightpoint at the impact location of the laser.
This command has to be executed every frame - see Arma 3: Mission Event Handlers - Draw3D.
Lasers drawn with this command are subject to the same limitations as weapon attachment lasers. These limitations are defined in the CfgIRLaserSettings config class.
Groups:
InteractionLights

Syntax

Syntax:
drawLaser [position, direction, beamColor, dotColor, dotSize, beamThickness, beamMaxLength, isIR]
Parameters:
position: PositionASL - the laser's origin position
direction: Array format Vector3D - the laser's direction vector
beamColor: Array format Color (RGB) - laser beam color. The values can go way above the usual 0..1 range as they also act as emissivity brightness
dotColor: Array format Color (RGB) - impact dot color. Set to [] to use the same value as beamColor.
dotSize: Number - impact dot size; if set to 0 the impact dot will not render
beamThickness: Number - laser beam thickness scale; if set to 0, the beam will not render
beamMaxLength (Optional, default: -1): Number - the maximum length of the laser beam. Special values:
  • -1: No limit other than that defined in CfgIRLaserSettings
  • 0: The drawLaser command is ignored
The maximum length of laser beams defined in CfgIRLaserSettings can not be exceeded, not even by setting this parameter to -1.
isIR (Optional, default: true): Boolean - whether the laser and impact dot are only visible with Night Vision / Thermal Imaging
Return Value:
Nothing

Examples

Example 1:
Give the player a laser eye: addMissionEventHandler ["Draw3D", { drawLaser [ eyePos player vectorAdd [0, 0, 0.1], getCameraViewDirection player, [1000, 0, 0], // Bright red [], 5, 20, -1, false ]; }];

Additional Information

See also:
drawIcon3D drawLine3D Arma 3: Mission Event Handlers - Draw3D

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note