camTilt should persist

This commit is contained in:
SilentSpike 2015-07-20 23:20:05 +01:00
parent 7a45c6543e
commit 005b2ad406
4 changed files with 8 additions and 12 deletions

View File

@ -22,6 +22,7 @@ GVAR(camMode) = 0;
GVAR(camPan) = 0;
GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,20];
GVAR(camSpeed) = 1;
GVAR(camTilt) = -10;
GVAR(camUnit) = objNull;
GVAR(camZoom) = 1.3;

View File

@ -56,4 +56,4 @@ GVAR(camPos) = [_x,_y,_z max (getTerrainHeightASL [_x,_y])];
// Update camera position and rotation
GVAR(camera) setPosASL GVAR(camPos);
GVAR(camera) setDir GVAR(camPan);
[GVAR(camera), GVAR(camTilt), GVAR(camBank)] call BIS_fnc_setPitchBank;
[GVAR(camera), GVAR(camTilt), 0] call BIS_fnc_setPitchBank;

View File

@ -26,10 +26,8 @@ switch (toLower _mode) do {
if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {};
// Initalize camera variables
GVAR(camBank) = 0;
GVAR(camBoom) = [false,false];
GVAR(camDolly) = [false,false,false,false];
GVAR(camTilt) = -10;
GVAR(gunCam) = false;
// Initalize display variables
@ -39,7 +37,6 @@ switch (toLower _mode) do {
// Initalize the camera view
GVAR(camera) = "Camera" camCreate GVAR(camPos);
GVAR(camera) setDir GVAR(camPan);
[] call FUNC(transitionCamera);
// Create the dialog
@ -68,10 +65,8 @@ switch (toLower _mode) do {
// Cleanup camera variables
GVAR(camera) = nil;
GVAR(camBank) = nil;
GVAR(camBoom) = nil;
GVAR(camDolly) = nil;
GVAR(camTilt) = nil;
GVAR(gunCam) = nil;
// Cleanup display variables

View File

@ -9,9 +9,10 @@
* - 2: External
* 1: Camera unit (objNull for random) <OBJECT> <OPTIONAL>
* 2: Camera position (ASL) <ARRAY> <OPTIONAL>
* 3: Camera heading (0 - 360) <NUMBER> <OPTIONAL>
* 4: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
* 5: Camera speed (m/s) <NUMBER> <OPTIONAL>
* 3: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
* 4: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
* 5: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
* 6: Camera speed (m/s) <NUMBER> <OPTIONAL>
*
* Return Value:
* None <NIL>
@ -24,19 +25,18 @@
#include "script_component.hpp"
params [["_mode",GVAR(camMode),[0]], ["_unit",GVAR(camUnit),[objNull]], ["_position",GVAR(camPos),[[]],3], ["_heading",GVAR(camPan),[0]], ["_zoom",GVAR(camZoom),[0]], ["_speed",GVAR(camSpeed),[0]]];
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]]];
// Normalize input
GVAR(camMode) = floor((_mode min 3) max 0);
GVAR(camPan) = ((_heading % 360) max 0);
GVAR(camPosition) = _position;
GVAR(camSpeed) = _speed;
GVAR(camTilt) = ((_heading min -90) max 90);
GVAR(camUnit) = _unit;
GVAR(camZoom) = (_zoom min 2) max 0;
// Apply if camera exists
if !(isNil QGVAR(camera)) then {
GVAR(camera) setDir GVAR(camPan);
GVAR(camera) setPosASL GVAR(camPos);
[] call FUNC(transitionCamera);
};