mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Adding vision to setCameraAttributes
This commit is contained in:
parent
c0fd26f706
commit
dcea8f4929
@ -14,6 +14,7 @@
|
|||||||
};*/
|
};*/
|
||||||
GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes);
|
GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes);
|
||||||
GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions);
|
GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions);
|
||||||
|
GVAR(camMode) = GVAR(availableModes) select 0;
|
||||||
|
|
||||||
if (GVAR(system)) then {
|
if (GVAR(system)) then {
|
||||||
// Add event handlers to correctly enter spectator upon death
|
// Add event handlers to correctly enter spectator upon death
|
||||||
|
@ -8,11 +8,16 @@
|
|||||||
* - 1: Internal
|
* - 1: Internal
|
||||||
* - 2: External
|
* - 2: External
|
||||||
* 1: Camera unit (objNull for random) <OBJECT> <OPTIONAL>
|
* 1: Camera unit (objNull for random) <OBJECT> <OPTIONAL>
|
||||||
* 2: Camera position (ASL) <ARRAY> <OPTIONAL>
|
* 2: Camera vision <NUMBER> <OPTIONAL>
|
||||||
* 3: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
|
* - -2: Normal
|
||||||
* 4: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
|
* - -1: Night vision
|
||||||
* 5: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
|
* - 0: Thermal white hot
|
||||||
* 6: Camera speed (m/s) <NUMBER> <OPTIONAL>
|
* - 1: Thermal black hot
|
||||||
|
* 3: Camera position (ASL) <ARRAY> <OPTIONAL>
|
||||||
|
* 4: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
|
||||||
|
* 5: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
|
||||||
|
* 6: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
|
||||||
|
* 7: Camera speed (m/s) <NUMBER> <OPTIONAL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None <NIL>
|
* None <NIL>
|
||||||
@ -25,18 +30,37 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params [["_mode",GVAR(camMode),[0]], ["_unit",GVAR(camUnit),[objNull]], ["_position",GVAR(camPos),[[]],3], ["_heading",GVAR(camPan),[0]], ["_tilt",GVAR(camTilt),[0]], ["_zoom",GVAR(camZoom),[0]], ["_speed",GVAR(camSpeed),[0]]];
|
params [
|
||||||
|
["_mode",GVAR(camMode),[0]],
|
||||||
|
["_unit",GVAR(camUnit),[objNull]],
|
||||||
|
["_vision",GVAR(camVision),[0]],
|
||||||
|
["_position",GVAR(camPos),[[]],3],
|
||||||
|
["_heading",GVAR(camPan),[0]],
|
||||||
|
["_tilt",GVAR(camTilt),[0]],
|
||||||
|
["_zoom",GVAR(camZoom),[0]],
|
||||||
|
["_speed",GVAR(camSpeed),[0]]
|
||||||
|
];
|
||||||
|
|
||||||
// Normalize input
|
// Normalize input
|
||||||
GVAR(camMode) = floor((_mode min 3) max 0);
|
if !(_mode in GVAR(availableModes)) then {
|
||||||
|
_mode = GVAR(availableModes) select 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_vision in GVAR(availableVisions)) then {
|
||||||
|
_vision = GVAR(availableVisions) select 0;
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(camPan) = ((_heading % 360) max 0);
|
GVAR(camPan) = ((_heading % 360) max 0);
|
||||||
GVAR(camPosition) = _position;
|
GVAR(camPosition) = _position;
|
||||||
GVAR(camSpeed) = _speed;
|
GVAR(camSpeed) = _speed;
|
||||||
GVAR(camTilt) = ((_heading min -90) max 90);
|
GVAR(camTilt) = ((_heading min -90) max 90);
|
||||||
GVAR(camUnit) = _unit;
|
GVAR(camUnit) = _unit;
|
||||||
|
GVAR(camVision) = _vision;
|
||||||
GVAR(camZoom) = (_zoom min 2) max 0;
|
GVAR(camZoom) = (_zoom min 2) max 0;
|
||||||
|
|
||||||
// Apply if camera exists
|
// Apply if camera exists
|
||||||
if !(isNil QGVAR(camera)) then {
|
if !(isNil QGVAR(camera)) then {
|
||||||
[] call FUNC(transitionCamera);
|
[_mode,_unit,_vision] call FUNC(transitionCamera);
|
||||||
|
} else {
|
||||||
|
GVAR(camMode) = _mode;
|
||||||
};
|
};
|
||||||
|
@ -27,11 +27,6 @@
|
|||||||
|
|
||||||
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
||||||
|
|
||||||
if !(_newMode in GVAR(availableModes)) exitWith {
|
|
||||||
[1] call FUNC(cycleCamera);
|
|
||||||
[nil, _newUnit, _newVision] call FUNC(transitionCamera);
|
|
||||||
};
|
|
||||||
|
|
||||||
// When no units available to spectate, exit to freecam
|
// When no units available to spectate, exit to freecam
|
||||||
if (GVAR(unitList) isEqualTo []) then {
|
if (GVAR(unitList) isEqualTo []) then {
|
||||||
_newMode = 0;
|
_newMode = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user