Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
CharacterCamera3rdPersonCrouch.c
Go to the documentation of this file.
1 // *************************************************************************************
2 // ! CharacterCamera3rdPersonCrouch - 3rd person camera in erected stance
3 // *************************************************************************************
5 {
6  //-----------------------------------------------------------------------------
7  void CharacterCamera3rdPersonCrouch(CameraHandlerComponent pCameraHandler)
8  {
9  m_fDistance = 1.2;
10  m_CameraOffsetMS = "0.0 0.7 0.0";
11  m_CameraOffsetLS = "0.0 0.3 0.0";
12  m_fShoulderWidth = 0.4;
13 
14  CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(m_CharacterAnimationComponent.FindComponent(CharacterCommandHandlerComponent));
15  m_CommandMove = cmdHandler.GetCommandMove();
16  return;
17  }
18 
19  //-----------------------------------------------------------------------------
20  override void OnUpdate(float pDt, out ScriptedCameraItemResult pOutResult)
21  {
23  float movement = m_ControllerComponent.GetMovementSpeed();
24  movement = (Math.Clamp(movement, 1, 3) - 1.0) * 0.5;
25  movement *= CONST_CAMERAMOVEMENTHEIGH;
26 
27  float stanceCameraHeight = 0.0;
28 
29  m_fCameraHeight = Math.SmoothCD(m_fCameraHeight, Math.Max(movement, stanceCameraHeight), m_fCameraHeightVel, 0.2, 1000, pDt);
30  m_CameraOffsetMS[1] = 0.7 + m_fCameraHeight;
31 
33  pOutResult.m_fFOV = m_fFOV;
34 
35  bool sprinting = m_ControllerComponent.IsSprinting();
36  if( sprinting )
37  pOutResult.m_fFOV = m_fFOV + 5 * m_fBobScale;
38 
39  super.OnUpdate(pDt, pOutResult);
40 
41  // Apply shake
42  if (m_CharacterCameraHandler)
43  m_CharacterCameraHandler.AddShakeToToTransform(pOutResult.m_CameraTM, pOutResult.m_fFOV);
44  }
45 
46  //-----------------------------------------------------------------------------
47  static const float CONST_CAMERAMOVEMENTHEIGH = 0.1;
48  static const float CONST_CAMERA_STANCE_ADJ_BY_MOVEMENT = 0.1;
49 
50  protected CharacterCommandMove m_CommandMove;
51 
52  protected float m_fCameraHeight, m_fCameraHeightVel;
53 };
m_fDistance
float m_fDistance
Definition: SCR_AIGroupTargetCluster.c:38
OnUpdate
override void OnUpdate(BaseWorld world, float timeslice)
Definition: game.c:910
CharacterCamera3rdPersonBase
Definition: CharacterCamera3rdPersonCrouch.c:4
CharacterCommandMove
CharacterCommandMove.
Definition: CharacterCommandMove.c:13
m_ControllerComponent
private SCR_CharacterControllerComponent m_ControllerComponent
Definition: CharacterCameraHandlerComponent.c:985
CharacterCamera3rdPersonCrouch
Definition: CharacterCamera3rdPersonSitting.c:4