Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SpeedByHeightManualCameraComponent.c
Go to the documentation of this file.
1//#define CURVE_APPLIED
2
4
6[BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
8{
9 [Attribute("0.06")]
10 float m_fSpeedCoef;
11
12 [Attribute(defvalue: "0.15")]
13 float m_fMinSpeed;
14
15 [Attribute(defvalue: "400")]
16 float m_fMaxHeight;
17
18 [Attribute("50.0")]
19 float m_fUnderwaterSpeedHeight; // When underwater, the camera will move at the speed it would if it was at this height
20
21 [Attribute("0 0 1 1", UIWidgets.CurveDialog, params: "1 1 0 0")]
22 private ref Curve m_fHeightCoef;
23
24 //------------------------------------------------------------------------------------------------
25 override void EOnCameraFrame(SCR_ManualCameraParam param)
26 {
27 vector pos = CoordFromCamera(param.transform[3]);
28 float surfaceY = param.world.GetSurfaceY(pos[0], pos[2]);
29
30#ifdef CURVE_APPLIED
31 float height = LegacyCurve.Curve(ECurveType.CurveProperty2D, (pos[1] - surfaceY) / m_fMaxHeight, m_fHeightCoef)[1];
32 param.multiplier *= Math.Max(height * m_fMaxHeight * m_fSpeedCoef, m_fMinSpeed);
33#else
34 surfaceY = Math.Max(surfaceY, 0); // this is so when you go off the MpTest terrain, you dont instantly switch speed to mach 10
35 float height = Math.AbsFloat(pos[1] - surfaceY);
36 if (pos[1] < 0) // When below water level maintain a constant speed no matter the depth
37 height = m_fUnderwaterSpeedHeight;
38
39 param.multiplier *= Math.Max(height * m_fSpeedCoef, m_fMinSpeed);
40#endif
41 }
42
43 //------------------------------------------------------------------------------------------------
44 override bool EOnCameraInit()
45 {
46 return true;
47 }
48}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition Math.c:22
Definition Math.c:13
Parent class from which all SCR_ManualCamera components inherit.
Parameter for carrying information between individual camera components.
BaseWorld world
World in which the camera exists.
SCR_FieldOfViewSettings Attribute
ECurveType
Definition ECurveType.c:13