Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ZoomManualCameraComponent.c
Go to the documentation of this file.
1
2
4[BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6{
7 protected static const float INERTIA_THRESHOLD = 0.001;
8
9 [Attribute(defvalue: "1", uiwidget: UIWidgets.Slider, desc: "Minimum field of view", params: "0 180 1")]
10 protected float m_fMinFOV;
11
12 [Attribute(defvalue: "120", uiwidget: UIWidgets.Slider, desc: "Maximum field of view", params: "0 180 1")]
13 protected float m_fMaxFOV;
14
15 [Attribute(defvalue: "0.1", desc: "Zoom value coefficient")]
16 protected float m_fCoef;
17
18 [Attribute(defvalue: "0.08", desc: "Indertia strength. Larger values mean more inertia.")]
19 protected float m_fInertiaStrength;
20
21 protected float m_fTargetFOV;
22 protected bool m_bIsAnimating;
23 protected bool m_bIsInstant;
25
26 //------------------------------------------------------------------------------------------------
32
33 //------------------------------------------------------------------------------------------------
35 {
36 if (m_fTargetFOV != 0)
37 data.m_aValues = {m_fTargetFOV};
38 }
39
40 //------------------------------------------------------------------------------------------------
42 {
43 m_fTargetFOV = data.m_aValues[0];
44 m_bIsInstant = true;
45 }
46
47 //------------------------------------------------------------------------------------------------
48 override void EOnCameraReset()
49 {
51 m_bIsAnimating = true;
52 }
53
54 //------------------------------------------------------------------------------------------------
56 {
57 if (!param.isManualInputEnabled)
58 return;
59
60 if (GetInputManager().GetActionValue("ManualCameraZoomReset"))
61 {
63 m_bIsAnimating = true;
64 }
65
66 float input = 0;
67 if (GetInputManager().IsUsingMouseAndKeyboard() || GetInputManager().GetActionValue("ManualCameraModifier"))
68 input = GetInputManager().GetActionValue("ManualCameraZoom");
69
70 if (input != 0)
71 {
72 m_fTargetFOV = Math.Clamp(param.fov * (1 - input * m_fCoef), m_fMinFOV, m_fMaxFOV);
73 m_bIsAnimating= true;
74 }
75
76 if (m_bIsInstant)
77 {
78 m_bIsInstant = false;
79 param.fov = m_fTargetFOV;
80 param.isDirty = true;
81 m_OnZoomChange.Invoke(param.fov);
82 }
83 else if (m_bIsAnimating)
84 {
85 param.fov = Math.Lerp(param.fov, m_fTargetFOV, Math.Min(param.timeSlice / m_fInertiaStrength, 1));
86 param.isDirty = true;
87 if (Math.AbsFloat(param.fov - m_fTargetFOV) < INERTIA_THRESHOLD)
88 m_bIsAnimating = false;
89
90 m_OnZoomChange.Invoke(param.fov);
91 }
92 }
93
94 //------------------------------------------------------------------------------------------------
95 override bool EOnCameraInit()
96 {
97 return true;
98 }
99}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
Parent class from which all SCR_ManualCamera components inherit.
Parameter for carrying information between individual camera components.
float timeSlice
Frame time slice.
override void EOnCameraSave(SCR_ManualCameraComponentSave data)
override void EOnCameraFrame(SCR_ManualCameraParam param)
override void EOnCameraLoad(SCR_ManualCameraComponentSave data)
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134