mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
common: function for drawing debug lines
This commit is contained in:
parent
60fa6dfbe6
commit
8bc92482f3
@ -6,6 +6,7 @@ PREP(addActionEventHandler);
|
|||||||
PREP(addActionMenuEventHandler);
|
PREP(addActionMenuEventHandler);
|
||||||
PREP(addCameraEventHandler);
|
PREP(addCameraEventHandler);
|
||||||
PREP(addCustomEventHandler);
|
PREP(addCustomEventHandler);
|
||||||
|
PREP(addLineToDebugDraw);
|
||||||
PREP(addMapMarkerCreatedEventHandler);
|
PREP(addMapMarkerCreatedEventHandler);
|
||||||
PREP(addScrollWheelEventHandler);
|
PREP(addScrollWheelEventHandler);
|
||||||
PREP(adminKick);
|
PREP(adminKick);
|
||||||
@ -24,6 +25,7 @@ PREP(closeDialogIfTargetMoves);
|
|||||||
PREP(codeToLetter);
|
PREP(codeToLetter);
|
||||||
PREP(codeToString);
|
PREP(codeToString);
|
||||||
PREP(convertKeyCode);
|
PREP(convertKeyCode);
|
||||||
|
PREP(createOrthonormalReference);
|
||||||
PREP(currentChannel);
|
PREP(currentChannel);
|
||||||
PREP(disableUserInput);
|
PREP(disableUserInput);
|
||||||
PREP(displayText);
|
PREP(displayText);
|
||||||
|
48
addons/common/functions/fnc_addLineToDebugDraw.sqf
Normal file
48
addons/common/functions/fnc_addLineToDebugDraw.sqf
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
*
|
||||||
|
* Add line to draw on debug
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Start point ASL (Array)
|
||||||
|
* 1: End point ASL (Array)
|
||||||
|
* 2: Color (Array)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if (isNil QGVAR(debugLines)) then {
|
||||||
|
GVAR(debugLines) = [];
|
||||||
|
GVAR(debugLinesIndex) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (count GVAR(debugLines) < 100) then {
|
||||||
|
GVAR(debugLines) pushBack _this;
|
||||||
|
GVAR(debugLinesIndex) = 0;
|
||||||
|
} else {
|
||||||
|
GVAR(debugLines) set [GVAR(debugLinesIndex), _this];
|
||||||
|
GVAR(debugLinesIndex) = (GVAR(debugLinesIndex) + 1) mod 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil QGVAR(debugDrawHandler)) then {
|
||||||
|
GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", {
|
||||||
|
if (count GVAR(debugLines) == 0) exitWith {
|
||||||
|
removeMissionEventHandler GVAR(debugDrawHandler);
|
||||||
|
GVAR(debugDrawHandler) = nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
_p0 = _x select 0;
|
||||||
|
if (!surfaceIsWater _p0) then {
|
||||||
|
_p0 = ASLtoATL _p0;
|
||||||
|
};
|
||||||
|
_p1 = _x select 1;
|
||||||
|
if (!surfaceIsWater _p1) then {
|
||||||
|
_p1 = ASLtoATL _p1;
|
||||||
|
};
|
||||||
|
drawLine3D [_p0, _p1, _x select 2];
|
||||||
|
} forEach GVAR(debugLines);
|
||||||
|
}];
|
||||||
|
};
|
21
addons/common/functions/fnc_createOrthonormalReference.sqf
Normal file
21
addons/common/functions/fnc_createOrthonormalReference.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
*
|
||||||
|
* Returns a orthonormal system of reference aligned with the supplied vector
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* Vector to align the coordinate system with (Array)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* 0: v1 (Array)
|
||||||
|
* 1: v2 (Array)
|
||||||
|
* 2: v3 (Array)
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_v1","_v2","_v3"];
|
||||||
|
_v1 = vectorNormalized _this;
|
||||||
|
_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]);
|
||||||
|
_v3 = _v2 vectorCrossProduct _v1;
|
||||||
|
|
||||||
|
[_v1,_v2,_v3]
|
Loading…
Reference in New Issue
Block a user