drawLaser: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Scalar" to "[[Number")
m (Text replacement - "{{HashLink" to "{{Link")
 
(12 intermediate revisions by 4 users not shown)
Line 2: Line 2:


|game1= arma3
|game1= arma3
|branch= dev


|version1= 2.08
|version1= 2.08
Line 9: Line 7:
|eff= local
|eff= local


|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>
Command has to be executed each frame. Use [[addMissionEventHandler]] "Draw3D" which is executed each frame.<br>
This command has to be executed every frame - see {{Link|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 '''CfgIRLaserSettings''' config class.
Lasers drawn with this command are subject to the same limitations as weapon attachment lasers. These limitations are defined in the {{hl|CfgIRLaserSettings}} config class.


|gr1= Interaction
|gr1= Interaction
Line 17: Line 15:
|gr2= Lights
|gr2= Lights


|s1= [[drawLaser]] [sourcePos, direction, color, thickness, dotSize, isIR]
|s1= [[drawLaser]] [position, direction, beamColor, dotColor, dotSize, beamThickness, beamMaxLength, isIR]
 
|p1= position: [[Array]] format [[Position#PositionASL|PositionASL]] - the laser's origin position
 
|p2= direction: [[Array]] of [[Vector3D]] - the laser's direction vector


|p1= sourcePos: [[PositionASL]] - World position of the Laser Source
|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


|p2= direction: [[Array]] - Direction vector along which the Laser will shine
|p4= dotColor: [[Array]] of [[Color|Color (RGB)]] - impact dot color. Set to <sqf inline>[]</sqf> to use the same value as ''beamColor''.


|p3= color: [[Array]] - RGB color of the laserbeam and impact dot
|p5= dotSize: [[Number]] - impact dot size; if set to 0 the impact dot will not render


|p4= color: [[Number]] - Thickness of the laser beam. If set to 0 the beam will not render.
|p6= beamThickness: [[Number]] - laser beam's thickness scale; if set to 0, the beam will not render


|p5= dotSize: [[Number]] - Size of the impact dot. If set to 0 the impact dot will not render.
|p7= beamMaxLength: [[Number]] - (Optional, default -1) laser beam's maximum length. {{hl|-1}} means maximum length (defined in {{hl|CfgIRLaserSettings}}), {{hl|0}} means no length at all and the command is ignored


|p6= isIR (Optional, default: [[true]]): [[Number]] - Whether the Laser and impact dot are only visible in Nightvision/Thermal Imaging  
|p8= isIR: [[Boolean]] - (Optional, default [[true]]) whether the laser and impact dot are only visible with Night Vision / Thermal Imaging


|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code> [[onEachFrame]] {[[drawLaser]] [[[eyePos]] [[player]] [[vectorAdd]] [0,0,0.1], [[getCameraViewDirection]] [[player]], [1000,0,0], 20, 5, [[false]]]}; {{cc|Gives player a laser eye}}</code>
|x1= Give the player a laser eye:
<sqf>
addMissionEventHandler ["Draw3D", {
drawLaser [
eyePos player vectorAdd [0, 0, 0.1],
getCameraViewDirection player,
[1000, 0, 0], // Bright red
[],
5,
20,
-1,
false
];
}];
</sqf>


|seealso= [[drawIcon3D]] [[drawLine3D]]
|seealso= [[drawIcon3D]] [[drawLine3D]] {{Link|Arma 3: Mission Event Handlers#Draw3D}}
}}
}}

Latest revision as of 17:43, 4 January 2023

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: Array format PositionASL - the laser's origin position
direction: Array of Vector3D - the laser's direction vector
beamColor: Array of 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 of 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'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 or on the Forums.
Only post proven facts here! Add Note