Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MoveManualCameraComponent.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6 {
7  [Attribute(defvalue: "27", desc: "Speed coefficient.")]
8  private float m_fSpeed;
9 
10  protected bool m_bBlockedByRadialMenu;
11 
12  //------------------------------------------------------------------------------------------------
13  override void EOnCameraSave(SCR_ManualCameraComponentSave data)
14  {
15  vector transform[4];
16  GetCameraEntity().GetWorldTransform(transform);
17  vector angles = Math3D.MatrixToAngles(transform);
18 
19  data.m_aValues = {
20  transform[3][0], transform[3][1], transform[3][2], //--- Pos
21  angles[0], angles[1] //--- Yaw, pitch (don't save roll, this component cannot change)
22  };
23  }
24 
25  //------------------------------------------------------------------------------------------------
26  override void EOnCameraLoad(SCR_ManualCameraComponentSave data)
27  {
28  if (!data.m_aValues || data.m_aValues.Count() < 5)
29  return;
30 
31  vector transform[4];
32  transform[3] = Vector(data.m_aValues[0], data.m_aValues[1], data.m_aValues[2]);
33  Math3D.AnglesToMatrix(Vector(data.m_aValues[3], data.m_aValues[4], 0), transform);
34 
35  GetCameraEntity().SetWorldTransform(transform);
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  override void EOnCameraFrame(SCR_ManualCameraParam param)
40  {
41  if (!param.isManualInputEnabled)
42  return;
43 
44  bool radialMenu = !m_InputManager.IsUsingMouseAndKeyboard() && (m_InputManager.GetActionValue("RadialX") || m_InputManager.GetActionValue("RadialY"));
45  if (radialMenu)
46  m_bBlockedByRadialMenu = true;
47 
48  float lateral = m_InputManager.GetActionValue("ManualCameraMoveLateral");
49  float vertical = m_InputManager.GetActionValue("ManualCameraMoveVertical");
50  float longitudinal = m_InputManager.GetActionValue("ManualCameraMoveLongitudinal");
51  if (lateral == 0 && vertical == 0 && longitudinal == 0)
52  {
53  if (!radialMenu)
54  m_bBlockedByRadialMenu = false;
55 
56  return;
57  }
58 
59  //--- Radial menu was just closed - block the input until player releases left stick
60  if (m_bBlockedByRadialMenu)
61  return;
62 
63  //--- Make sure that horizontal input is not bigger than 1 (happens on gamepad when moving diagonally)
64  vector newDir = Vector(lateral, 0, longitudinal);
65  if (newDir.LengthSq() > 1)
66  newDir.Normalize();
67 
68  //--- Get horizontal vector
69  vector currentDir = param.transform[2];
70  currentDir[1] = 0;
71  currentDir.Normalize();
72 
73  float horizontalSpeedCoef = param.multiplier[0] * m_fSpeed;
74  param.transform[3] = param.transform[3] + Vector(
75  (currentDir[0] * newDir[2] + currentDir[2] * newDir[0]) * horizontalSpeedCoef,
76  vertical * param.multiplier[1] * m_fSpeed,
77  (currentDir[2] * newDir[2] - currentDir[0] * newDir[0]) * horizontalSpeedCoef,
78  );
79  param.isManualInput = true;
80  param.isDirty = true;
81  }
82 
83  //------------------------------------------------------------------------------------------------
84  override bool EOnCameraInit()
85  {
86  return true;
87  }
88 }
m_InputManager
protected InputManager m_InputManager
Definition: SCR_BaseManualCameraComponent.c:15
SCR_BaseManualCameraComponent
Parent class from which all SCR_ManualCamera components inherit.
Definition: SCR_BaseManualCameraComponent.c:5
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_MoveManualCameraComponent
Camera movement above sea level.
Definition: SCR_MoveManualCameraComponent.c:5
SCR_ManualCameraComponentSave
Definition: SCR_ManualCameraSave.c:15
GetCameraEntity
protected SCR_ManualCamera GetCameraEntity()
Definition: SCR_BaseManualCameraComponent.c:59
SCR_ManualCameraParam
Parameter for carrying information between individual camera components.
Definition: SCR_ManualCameraParam.c:5
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
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