ACE3/addons/missileguidance/functions/fnc_dev_ProjectileCamera.sqf

62 lines
1.6 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2024-07-29 17:32:33 +00:00
/*
* Author: tcvm
* tracks a projectile until it explodes
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
params ["_projectile"];
private _camera = "camera" camCreate getPosATL _projectile;
_camera camPrepareFOV 0.7;
_camera cameraEffect ["internal", "back"];
_camera camCommitPrepared 0;
2021-04-16 22:18:28 +00:00
GVAR(debug_camera_close) = false;
private _displayEH = (findDisplay 46) displayAddEventHandler ["KeyDown", {
2021-05-02 07:40:23 +00:00
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
GVAR(debug_camera_close) = (_key == 1);
true
2021-04-16 22:18:28 +00:00
}];
[{
2021-05-02 07:40:23 +00:00
params ["_args", "_pfh"];
_args params ["_projectile", "_camera", "_projectilePos", "_displayEH"];
if (!alive _projectile || GVAR(debug_camera_close)) exitWith {
private _delay = 1.5;
if (GVAR(debug_camera_close)) then {
_delay = 0;
};
2021-04-16 22:18:28 +00:00
2021-05-02 07:40:23 +00:00
(findDisplay 46) displayRemoveEventHandler ["KeyDown", _displayEH];
2021-04-16 22:18:28 +00:00
2021-05-02 07:40:23 +00:00
[{
params ["_camera"];
2021-05-02 07:40:23 +00:00
_camera cameraEffect ["terminate", "back"];
_camera camCommitPrepared 0;
camDestroy _camera;
}, [_camera], _delay] call CBA_fnc_waitAndExecute;
2021-05-02 07:40:23 +00:00
_camera camPrepareTarget _projectilePos;
_camera camCommitPrepared 0;
2021-05-02 07:40:23 +00:00
[_pfh] call CBA_fnc_removePerFrameHandler;
};
2021-05-02 07:40:23 +00:00
private _currentProjectilePos = getPosATLVisual _projectile;
2021-05-02 07:40:23 +00:00
_camera camPrepareTarget _projectile;
_camera camPrepareRelPos [0, -5, 1];
_camera camCommitPrepared 0;
2021-05-02 07:40:23 +00:00
_args set [2, getPosATL _projectile];
}, 0, [_projectile, _camera, getPosATL _projectile, _displayEH]] call CBA_fnc_addPerFrameHandler;