mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Adjust spectator camera pan and tilt with zoom
This commit is contained in:
parent
213deeffb4
commit
182eef39de
@ -20,12 +20,15 @@
|
||||
// Kill PFH when not in free cam (or display is closed)
|
||||
if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
||||
|
||||
private ["_oldPos","_mX","_mY","_mZ","_pan","_x","_y","_z"];
|
||||
private ["_oldPos","_zoomMod","_mX","_mY","_mZ","_pan","_x","_y","_z"];
|
||||
|
||||
_oldPos = getPosASL GVAR(camera);
|
||||
_mX = (GVAR(camDolly) select 0) / ((GVAR(camZoom) * 0.8) max 1);
|
||||
_mY = (GVAR(camDolly) select 1) / ((GVAR(camZoom) * 0.8) max 1);
|
||||
_mZ = GVAR(camBoom) / ((GVAR(camZoom) * 0.8) max 1);
|
||||
|
||||
// Dolly/Boom amount should be influnced by zoom level (it should really be exponential)
|
||||
_zoomMod = (GVAR(camZoom) * 0.8) max 1;
|
||||
_mX = (GVAR(camDolly) select 0) / _zoomMod;
|
||||
_mY = (GVAR(camDolly) select 1) / _zoomMod;
|
||||
_mZ = GVAR(camBoom) / _zoomMod;
|
||||
|
||||
_pan = (GVAR(camPan) + 360) % 360;
|
||||
_x = (_oldPos select 0) + (_mX * cos(_pan)) + (_mY * sin(_pan));
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_x","_y"];
|
||||
private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY"];
|
||||
private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY","_zoomMod"];
|
||||
|
||||
_leftButton = GVAR(mouse) select 0;
|
||||
_rightButton = GVAR(mouse) select 1;
|
||||
@ -35,8 +35,11 @@ if (_leftButton) then {
|
||||
GVAR(camDolly) set [1, _deltaY * 100 * GVAR(camSpeed)];
|
||||
} else {
|
||||
if (_rightButton) then {
|
||||
GVAR(camPan) = GVAR(camPan) - (_deltaX * 360);
|
||||
GVAR(camTilt) = ((GVAR(camTilt) + (_deltaY * 180)) min 89) max -89;
|
||||
// Pan/Tilt amount should be influnced by zoom level (it should really be exponential)
|
||||
_zoomMod = (GVAR(camZoom) * 0.8) max 1;
|
||||
|
||||
GVAR(camPan) = GVAR(camPan) - ((_deltaX * 360) / _zoomMod);
|
||||
GVAR(camTilt) = ((GVAR(camTilt) + ((_deltaY * 180) / _zoomMod)) min 89) max -89;
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user