drawLaser: Difference between revisions

From Bohemia Interactive Community
mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 17: Line 17:
|s1= [[drawLaser]] [position, direction, beamColor, dotColor, dotSize, beamThickness, beamMaxLength, isIR]
|s1= [[drawLaser]] [position, direction, beamColor, dotColor, dotSize, beamThickness, beamMaxLength, isIR]


|p1= position: [[Array]] format [[Position#PositionASL|PositionASL]] - the laser's origin position
|p1= position: [[Position#PositionASL|PositionASL]] - the laser's origin position


|p2= direction: [[Array]] of [[Vector3D]] - the laser's direction vector
|p2= direction: [[Array]] of [[Vector3D]] - the laser's direction vector


|p3= beamColor: [[Array]] of [[Color|Color (RGB)]] - laser beam color. The values can go way above the usual 0..1 range as they also act as emissivity brightness
|p3= beamColor: [[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= dotColor: [[Array]] of [[Color|Color (RGB)]] or [[Array|Empty Array]] - impact dot color. Set to <sqf inline>[]</sqf> to use the same value as ''beamColor''.
|p4= dotColor: [[Color|Color (RGB)]] or [[Array|Empty Array]] - impact dot color. Set to <sqf inline>[]</sqf> 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

Latest revision as of 01:22, 3 January 2026

Hover & click on the images for description

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 of Vector3D - the laser's direction vector
beamColor: Color (RGB) - laser beam color. The values can go way above the usual 0..1 range as they also act as emissivity brightness
dotColor: Color (RGB) or Empty Array - 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's thickness scale; if set to 0, the beam will not render
beamMaxLength: Number - (Optional, default -1) laser beam's maximum length. -1 means maximum length (defined in CfgIRLaserSettings), 0 means no length at all and the command is ignored
isIR: Boolean - (Optional, default true) 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.
Only post proven facts here! Add Note