Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RecoilCameraShakeParams.c
Go to the documentation of this file.
1 /*
2  This object defines the shape and default behaviour of camera shake and convenience API.
3 */
6 {
7  [Attribute("0.01", UIWidgets.Slider, params: "0.001 1.0 0.001", precision: 3, category: "Camera Shake", desc: "Time rate of shake blending in.")]
8  float m_fBlendInTime;
9  [Attribute("0.175", UIWidgets.Slider, params: "0.001 1.0 0.001", precision: 3, category: "Camera Shake", desc: "Time rate of shake blending out.")]
10  float m_fBlendOutTime;
11  [Attribute("15.0", UIWidgets.Slider, params: "0.0 60.0 0.001", precision: 3, category: "Camera Shake", desc: "Maximum smoothing velocity.")]
12  float m_fMaxVelocity;
13 
17  [Attribute("0.0375", UIWidgets.Slider, params: "0.0 1.0 0.001", precision: 3, category: "Camera Shake", desc: "Distance of translation at which recoil is deemed at maximum scale.")]
18  float m_fRecoilTarget;
19  [Attribute("1.25", UIWidgets.Slider, params: "0.0 3.0 0.001", precision: 3, category: "Camera Shake", desc: "Maximum percentage of recoil applied based on current vs target recoil translation.")]
20  float m_fMaximumPercentage;
21 
22 
23  /*
24  The minimum translation range to pick a random value from.
25  This is the raw value per axis (+right, +up, +forward in meters).
26  Keep positive only, sign is generated randomly.
27  */
28  [Attribute("0.0005 0.00050.0", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Minimum range to pick translation values from. +right +up +forward in meters.")]
29  protected vector m_vTranslationMin;
30  /*
31  The maximum translation range to pick a random value from.
32  This is the raw value per axis (+right, +up, +forward in meters).
33  Keep positive only, sign is generated randomly.
34  */
35  [Attribute("0.006 0.006 0.0", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Maximum range to pick translation values from. +right +up +forward in meters.")]
36  protected vector m_vTranslationMax;
37 
41  [Attribute("0.975", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Percentage of field of view when shake is at peak value.")]
42  protected float m_fFOVModifier;
43 
44  /*
45  On top of the continuous shake there is an impulse which is stronger and has single direction
46  for the entirety or most of the underlying shake duration. This value defines the minimum
47  rotation range of this impulse.
48  */
49  [Attribute("0.005 0.005 1.0", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "On top of the continuous shake there is an impulse which is stronger and has single direction for the entirety or most of the underlying shake duration. This value defines the minimum rotation range of this impulse. +pitch +yaw +roll in in degrees.")]
50  protected vector m_vRotationImpulseMin;
51 
52  /*
53  On top of the continuous shake there is an impulse which is stronger and has single direction
54  for the entirety or most of the underlying shake duration. This value defines the maximum
55  rotation range of this impulse.
56  */
57  [Attribute("0.012 0.012 1.5", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "On top of the continuous shake there is an impulse which is stronger and has single direction for the entirety or most of the underlying shake duration. This value defines the maximum rotation range of this impulse. +pitch +yaw +roll in degrees.")]
58  protected vector m_vRotationImpulseMax;
59 
60  /*
61  The minimum recoil delta that can trigger large impulses.
62  */
63  [Attribute("0.04", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "The minimum recoil delta that can trigger impulses.")]
64  float m_fMinImpulseThreshold;
65 
66  /*
67  The minimum rate at which impulses can be added. (0.1 == up to 0.1 impulses per second, 1.0 == up to 1 impulses per second)
68  */
69  [Attribute("0.333", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "The minimum rate at which impulses can be added. (0.1 == up to 0.1 impulses per second, 1.0 == up to 1 impulses per second.")]
70  float m_fMinImpulseRate;
71 
72  /*
73  Impulse magnitude multiplier for when character is crouching.
74  */
75  [Attribute("0.8", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Impulse magnitude multiplier for when character is crouching.", params: "0 1 0.01")]
76  float m_fImpulseCrouchMagnitudeModifier;
77 
78  /*
79  Impulse magnitude multiplier for when character is crouching.
80  */
81  [Attribute("0.6", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Impulse magnitude multiplier for when character is crouching.", params: "0 1 0.01")]
82  float m_fImpulseProneMagnitudeModifier;
83 
84  /*
85  Continuous magnitude multiplier for when character is crouching.
86  */
87  [Attribute("0.8", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Continuous magnitude multiplier for when character is crouching.", params: "0 1 0.01")]
88  float m_fCrouchMagnitudeModifier;
89 
90  /*
91  Continuous magnitude multiplier for when character is crouching.
92  */
93  [Attribute("0.6", UIWidgets.EditBox, precision: 3, category: "Camera Shake", desc: "Continuous magnitude multiplier for when character is crouching.", params: "0 1 0.01")]
94  float m_fProneMagnitudeModifier;
95 
99  protected ref RandomGenerator m_pRandomGenerator = new RandomGenerator();
100 
105  float GetStanceImpulseMagnitude(float dynamicStance)
106  {
107  return GetMagnitude(dynamicStance, m_fImpulseCrouchMagnitudeModifier, m_fImpulseProneMagnitudeModifier, 1.0);
108  }
109 
114  float GetStanceMagnitude(float dynamicStance)
115  {
116  return GetMagnitude(dynamicStance, m_fCrouchMagnitudeModifier, m_fProneMagnitudeModifier, 1.0);
117  }
118 
119  protected float GetMagnitude(float stance, float crouch, float prone, float erect)
120  {
121  // Interpolate between crouch and erect
122  if (stance >= 0.5)
123  {
124  float t = (stance * 2) - 1.0;
125  return Math.Lerp(crouch, erect, t);
126  }
127 
128  // Interpolate between prone and crouch
129  float t = (stance * 2);
130  return Math.Lerp(prone, crouch, t);
131  }
132 
136  protected float RandomFloat(float min, float max)
137  {
138  if (min < 0.00001 || max < 0.00001)
139  return 0.0;
140 
141  float sign = m_pRandomGenerator.RandFloatXY(-1337, 1337).Sign();
142  return sign * m_pRandomGenerator.RandFloatXY(min, max);
143  }
144 
148  protected vector RandomVector(vector min, vector max)
149  {
150  vector result;
151  result[0] = RandomFloat(min[0], max[0]);
152  result[1] = RandomFloat(min[1], max[1]);
153  result[2] = RandomFloat(min[2], max[2]);
154  return result;
155  }
156 
160  protected vector RandomVectorSphere(vector min, vector max, bool uniform = true)
161  {
162  float sign = m_pRandomGenerator.RandFloatXY(-1337, 1337).Sign();
163  vector res = m_pRandomGenerator.GenerateRandomPointInRadius(min.Length(), max.Length(), vector.Zero, uniform);
164  res[0] = Math.Clamp(res[0], min[0], max[0]);
165  res[1] = Math.Clamp(res[1], min[1], max[1]);
166  res[2] = Math.Clamp(res[2], min[2], max[2]);
167  return sign * res;
168  }
169 
173  float GetFovScale(float progress01)
174  {
175  progress01 = Math.Clamp(progress01, 0.0, 1.0);
176  return Math.Lerp(1.0, m_fFOVModifier, progress01);
177  }
178 
182  vector GetRandomTranslation(bool onSphere = false)
183  {
184  if (onSphere)
185  return RandomVectorSphere(m_vTranslationMin, m_vTranslationMax);
186 
187  return RandomVector(m_vTranslationMin, m_vTranslationMax);
188  }
189 
190  /*
191  Returns random angle impulse in the pitch yaw roll format.
192  */
193  vector GetRandomAnglesImpulse(bool onSphere = false)
194  {
195  if (onSphere)
196  return RandomVectorSphere(m_vRotationImpulseMin, m_vRotationImpulseMax);
197 
198  return RandomVector(m_vRotationImpulseMin, m_vRotationImpulseMax);
199  }
200 
201  /*
202  Returns random angle impulse in the yaw pitch roll format.
203  */
204  vector GetRandomYawPitchRollImpulse(bool onSphere = false)
205  {
206  vector angles = GetRandomAnglesImpulse(onSphere);
207  return Vector(angles[1], angles[0], angles[2]);
208  }
209 };
m_pRandomGenerator
SCR_LightningComponentClass m_pRandomGenerator
Inform the weather manager a lightning has been spawned. Weather Manager will handle light changes.
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_RecoilCameraShakeParams
Definition: SCR_RecoilCameraShakeParams.c:5
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
BaseItemAttributeData
Definition: BaseItemAttributeData.c:12