mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
55 lines
2.0 KiB
Plaintext
55 lines
2.0 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Nelson Duarte, SilentSpike
|
|
* Moves the spectator camera to a position relative to the camera focus.
|
|
* Used for 3PP camera and teleporting, etc.
|
|
*
|
|
* Arguments:
|
|
* 0: New Target <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player] call ace_spectator_fnc_cam_prepareTarget
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
private _focus = vehicle (param [0, objNull, [objNull]]);
|
|
TRACE_1("cam_prepareTarget",_focus);
|
|
|
|
if !(isNull _focus) then {
|
|
// Zooming takes place smoothly over multiple frames
|
|
// _zoom is target set by user, _zoomTrue is actual value each frame
|
|
private _zoom = [0, GVAR(camDistance)] select (GVAR(camMode) == MODE_FOLLOW);
|
|
private _zoomTrue = GVAR(camDistanceTrue);
|
|
|
|
// Interpolate zoom each frame until desired zoom is reached
|
|
if (_zoomTrue != _zoom) then {
|
|
_zoomTrue = (_zoomTrue * (1 - GVAR(camDeltaTime) * 10)) + (_zoom * GVAR(camDeltaTime) * 10);
|
|
GVAR(camDistanceTrue) = _zoomTrue;
|
|
TRACE_2("new zoom",GVAR(camDeltaTime),_zoomTrue);
|
|
};
|
|
|
|
// The distance at which to place camera from the focus pivot
|
|
private _bbd = [_focus] call BIS_fnc_getObjectBBD;
|
|
private _distance = (_bbd select 1) + _zoomTrue;
|
|
|
|
// The pivot on the target vehicle
|
|
private _isMan = _focus isKindOf "Man";
|
|
private _height = if !(_isMan) then { (_bbd select 2) / 3 } else { switch (stance _focus) do { case "STAND": {1.4}; case "CROUCH": {0.8}; default {0.4}; }; };
|
|
|
|
private _center = if (_isMan) then { AGLToASL (_focus modelToWorldVisual (_focus selectionPosition "Spine3")) } else { AGLToASL (_focus modelToWorldVisual [0,0,_height]) };
|
|
|
|
// Set dummy location and rotation
|
|
private _dummy = GVAR(camDummy);
|
|
|
|
_dummy setPosASL _center;
|
|
[_dummy, [GVAR(camYaw), GVAR(camPitch), 0]] call BIS_fnc_setObjectRotation;
|
|
|
|
// Apply location and rotation to camera
|
|
GVAR(camera) setPosASL (AGLToASL (_dummy modelToWorldVisual [0, -_distance, 0]));
|
|
GVAR(camera) setVectorDirAndUp [vectorDirVisual _dummy, vectorUpVisual _dummy];
|
|
};
|