Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
CharacterCameraDebug.c
Go to the documentation of this file.
1 // *************************************************************************************
2 // ! CharacterCameraDebug - debug views
3 // *************************************************************************************
5 {
6  //------------------------------------------------------------------------------------------------
7  // constructor
8  void CharacterCameraDebug(CameraHandlerComponent pCameraHandler)
9  {
10  m_iHeadBoneIndex = m_OwnerCharacter.GetAnimation().GetBoneIndex("Head");
11 
12  m_WeaponManager = BaseWeaponManagerComponent.Cast(m_OwnerCharacter.FindComponent(BaseWeaponManagerComponent));
13  }
14 
15  //------------------------------------------------------------------------------------------------
16  override void OnActivate (ScriptedCameraItem pPrevCamera, ScriptedCameraItemResult pPrevCameraResult)
17  {
18  super.OnActivate(pPrevCamera, pPrevCameraResult);
19  }
20 
21  //------------------------------------------------------------------------------------------------
22  override void OnUpdate(float pDt, out ScriptedCameraItemResult pOutResult)
23  {
24  pOutResult.m_bUpdateWhenBlendOut = false;
25  pOutResult.m_bWSCameraSmoothing = false;
26  pOutResult.m_pOwner = m_OwnerCharacter;
27 
28  int debugView = DiagMenu.GetValue(SCR_DebugMenuID.DEBUGUI_CHARACTER_DEBUG_VIEW);
29  if( debugView == CharacterCameraSet.DEBUGVIEW_FACE )
30  {
31  Math3D.MatrixIdentity4(pOutResult.m_CameraTM);
32 
33  // position
34  pOutResult.m_CameraTM[3] = "0.0 0.03 -0.07";
35  pOutResult.m_CameraTM[3] = -vector.Forward * 0.6 + pOutResult.m_CameraTM[3];
36 
37  pOutResult.m_iDirectBone = m_iHeadBoneIndex;
38  pOutResult.m_iDirectBoneMode = EDirectBoneMode.RelativeDirection;
39  pOutResult.m_fUseHeading = 0.0;
40  pOutResult.m_fFOV = 30;
41 
42  super.OnUpdate(pDt, pOutResult);
43  }
44  else if( debugView == CharacterCameraSet.DEBUGVIEW_WEAPON )
45  {
46  vector charMat[4];
47  m_OwnerCharacter.GetTransform(charMat);
48 
49  vector baseMat[4];
50  if (m_WeaponManager)
51  m_WeaponManager.GetCurrentMuzzleTransform(baseMat);
52  else
53  m_OwnerCharacter.GetTransform(baseMat);
54 
55  vector rotMat[3];
56  Math3D.AnglesToMatrix("180 0 0", rotMat);
57  Math3D.MatrixMultiply3(baseMat, rotMat, pOutResult.m_CameraTM);
58  pOutResult.m_CameraTM[3] = baseMat[2] * 1.5 + baseMat[3];
59 
60  Math3D.MatrixInvMultiply4(charMat, pOutResult.m_CameraTM, pOutResult.m_CameraTM);
61 
62  pOutResult.m_fFOV = 40;
63  }
64  else
65  {
66  //vector rotMat[3];
67  if (debugView == CharacterCameraSet.DEBUGVIEW_LEFT)
68  Math3D.AnglesToMatrix("90 0 0", pOutResult.m_CameraTM);
69  else if (debugView == CharacterCameraSet.DEBUGVIEW_RIGHT)
70  Math3D.AnglesToMatrix("-90 0 0", pOutResult.m_CameraTM);
71  else if (debugView == CharacterCameraSet.DEBUGVIEW_FRONT)
72  Math3D.AnglesToMatrix("180 0 0", pOutResult.m_CameraTM);
73  else if (debugView == CharacterCameraSet.DEBUGVIEW_REAR)
74  Math3D.AnglesToMatrix("0 0 0", pOutResult.m_CameraTM);
75  else if (debugView == CharacterCameraSet.DEBUGVIEW_TOP)
76  Math3D.AnglesToMatrix("0 -90 0", pOutResult.m_CameraTM);
77  else if (debugView == CharacterCameraSet.DEBUGVIEW_BOTTOM)
78  Math3D.AnglesToMatrix("0 90 0", pOutResult.m_CameraTM);
79 
80  pOutResult.m_fUseHeading = 0.0;
81  pOutResult.m_CameraTM[3] = pOutResult.m_CameraTM[2] * -2.5 + vector.Up * 1;
82  pOutResult.m_fFOV = 50;
83  }
84  }
85 
86  protected int m_iHeadBoneIndex;
87  protected BaseWeaponManagerComponent m_WeaponManager = null;
88 }
CharacterCameraDebug
Definition: CharacterCameraDebug.c:4
CharacterCameraSet
Definition: CharacterCameraSet.c:1
CharacterCameraBase
Definition: CharacterCameraADS.c:4
m_OwnerCharacter
private SCR_ChimeraCharacter m_OwnerCharacter
Definition: CharacterCameraHandlerComponent.c:984
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3