7 protected static const float INERTIA_THRESHOLD = 0.001;
9 [
Attribute(defvalue:
"1", uiwidget: UIWidgets.Slider,
desc:
"Minimum field of view",
params:
"0 180 1")]
10 protected float m_fMinFOV;
12 [
Attribute(defvalue:
"120", uiwidget: UIWidgets.Slider,
desc:
"Maximum field of view",
params:
"0 180 1")]
13 protected float m_fMaxFOV;
16 protected float m_fCoef;
18 [
Attribute(defvalue:
"0.08",
desc:
"Indertia strength. Larger values mean more inertia.")]
19 protected float m_fInertiaStrength;
21 protected float m_fTargetFOV;
22 protected bool m_bIsAnimating;
23 protected bool m_bIsInstant;
24 protected ref ScriptInvoker m_OnZoomChange =
new ScriptInvoker();
28 ScriptInvoker GetOnZoomChange()
30 return m_OnZoomChange;
36 if (m_fTargetFOV != 0)
37 data.m_aValues = {m_fTargetFOV};
43 m_fTargetFOV =
data.m_aValues[0];
48 override void EOnCameraReset()
57 if (!param.isManualInputEnabled)
72 m_fTargetFOV = Math.Clamp(param.fov * (1 - input * m_fCoef), m_fMinFOV, m_fMaxFOV);
79 param.fov = m_fTargetFOV;
81 m_OnZoomChange.Invoke(param.fov);
85 param.fov = Math.Lerp(param.fov, m_fTargetFOV, Math.Min(param.timeSlice /
m_fInertiaStrength, 1));
87 if (Math.AbsFloat(param.fov - m_fTargetFOV) < INERTIA_THRESHOLD)
90 m_OnZoomChange.Invoke(param.fov);
95 override bool EOnCameraInit()