Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MovementInertiaManualCameraComponent.c
Go to the documentation of this file.
1
2
4[BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6{
7 protected static const float INERTIA_THRESHOLD = 0.0002; //--- Squared value
8
9 [Attribute(defvalue: "0.08", desc: "Inertia strength. Larger values mean more inertia.")]
10 private float m_fInertiaStrength;
11
12 private vector m_vVelocity;
13
14 //------------------------------------------------------------------------------------------------
15 override void EOnCameraFrame(SCR_ManualCameraParam param)
16 {
17 //--- Current velocity
18 vector velocity = param.transform[3] - param.transformOriginal[3];
19
20 //--- Terminate when target velocity was achieved
21 if (!param.isManualInput && vector.DistanceSq(velocity, param.velocityOriginal) < INERTIA_THRESHOLD)
22 return;
23
24 //--- Apply
25 float progress = Math.Min(param.timeSlice * m_fInertiaStrength, 1);
26 velocity = vector.Lerp(param.velocityOriginal, velocity, progress);
27 vector pos = param.transformOriginal[3] + velocity;
28
29 param.transform[3] = pos;
30 param.isDirty = true;
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override bool EOnCameraInit()
35 {
36 m_fInertiaStrength = 1 / Math.Max(m_fInertiaStrength, 0.001);
37 return true;
38 }
39}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
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.
SCR_FieldOfViewSettings Attribute