Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
dayzplayercamera1stperson.c
Go to the documentation of this file.
1 // *************************************************************************************
2 // ! DayZPlayerCamera1stPerson - 1st person camera
3 // *************************************************************************************
5 {
6  static const float CONST_UD_MIN = -85.0;
7  static const float CONST_UD_MAX = 85.0;
8 
9  static const float CONST_LR_MIN = -160.0;
10  static const float CONST_LR_MAX = 160.0;
11 
12 
14  {
15  m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
16  if (m_iBoneIndex == -1)
17  {
18  Print("DayZPlayerCamera1stPerson: main bone not found");
19  }
20 
21  m_OffsetLS = "0.04 0.04 0"; //x - up, y - forward
22  }
23 
24 
25  //
26  override void OnActivate(DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
27  {
28  super.OnActivate(pPrevCamera, pPrevCameraResult);
29 
30  if (pPrevCamera)
31  {
32  vector baseAngles = pPrevCamera.GetBaseAngles();
33  m_fUpDownAngle = baseAngles[0];
34  m_fLeftRightAngle = baseAngles[1];
35 
36  vector addAngles = pPrevCamera.GetAdditiveAngles();
37  m_fUpDownAngleAdd = addAngles[0];
38  m_fLeftRightAngleAdd = addAngles[1];
39  }
40  }
41 
42  //
43  override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
44  {
48 
50  Math3D.YawPitchRollMatrix(GetCurrentOrientation(), pOutResult.m_CameraTM);
51  pOutResult.m_CameraTM[3] = m_OffsetLS;
52 
53  pOutResult.m_iDirectBone = m_iBoneIndex;
54  pOutResult.m_iDirectBoneMode = 1;
55  pOutResult.m_fUseHeading = 1.0;
56  pOutResult.m_fInsideCamera = 1.0;
57 
58  pOutResult.m_fNearPlane = 0.04; //0.07 default
59 
61 
63  StdFovUpdate(pDt, pOutResult);
65  }
66 
67  override vector GetBaseAngles()
68  {
69  vector a;
70  a[0] = m_fUpDownAngle;
71  a[1] = m_fLeftRightAngle;
72  a[2] = 0;
73  return a;
74  }
75 
76  override vector GetAdditiveAngles()
77  {
78  vector a;
79  a[0] = m_fUpDownAngleAdd;
80  a[1] = m_fLeftRightAngleAdd;
81  a[2] = 0;
82  return a;
83  }
84 
85  override string GetCameraName()
86  {
87  return "DayZPlayerCamera1stPerson";
88  }
89 
90  protected int m_iBoneIndex;
91  protected vector m_OffsetLS;
92 
93  protected float m_fUpDownAngle;
94  protected float m_fUpDownAngleAdd;
95  protected float m_fLeftRightAngle;
96  protected float m_fLeftRightAngleAdd;
97 }
98 
99 // *************************************************************************************
100 // ! DayZPlayerCamera1stPersonUnconscious - first person only unconscious
101 // *************************************************************************************
103 {
105  {
106  m_iBoneIndex = pPlayer.GetBoneIndexByName ("Head");
107  }
108 
109  override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
110  {
111  super.OnUpdate(pDt, pOutResult);
112 
113  pOutResult.m_iDirectBone = m_iBoneIndex;
114  pOutResult.m_iDirectBoneMode = 4;
115  pOutResult.m_fUseHeading = 0.0;
116 
117  vector rot;
118  rot[0] = 0;
119  rot[1] = 90;
120  rot[2] = 0;
121 
122  Math3D.YawPitchRollMatrix(rot, pOutResult.m_CameraTM);
123  }
124 }
CONST_UD_MIN
class DayZPlayerCamera1stPersonVehicle extends DayZPlayerCamera1stPerson CONST_UD_MIN
down limit
OnActivate
override void OnActivate(DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
Definition: dayzplayercamera1stperson.c:22
DayZPlayerCamera1stPerson
void DayZPlayerCamera1stPerson(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera1stperson.c:9
UpdateUDAngleUnlocked
float UpdateUDAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
Definition: dayzplayercamera_base.c:129
ProcessCameraShake
void ProcessCameraShake(float delta, out float leftRight, out float upDown)
Definition: dayzplayercamera_base.c:108
m_iBoneIndex
protected int m_iBoneIndex
main bone
Definition: dayzplayercamera1stperson.c:86
DayZPlayerCamera
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayer.c:56
m_fLeftRightAngle
protected float m_fLeftRightAngle
left right angle in rad (in freelook only)
Definition: dayzplayercamera1stperson.c:91
Print
proto void Print(void var)
Prints content of variable to console/log.
GetCameraName
override string GetCameraName()
Definition: dayzplayercamera1stperson.c:81
UpdateLRAngleUnlocked
float UpdateLRAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
Definition: dayzplayercamera_base.c:170
m_OffsetLS
protected vector m_OffsetLS
position offset
Definition: dayzplayercamera1stperson.c:87
DayZPlayer
Definition: dayzplayerimplement.c:72
PlayerBase
Definition: playerbaseclient.c:1
m_pPlayer
protected DayZPlayer m_pPlayer
data
Definition: dayzplayer.c:135
vector
Definition: enconvert.c:105
m_CurrentCameraPitch
protected float m_CurrentCameraPitch
Definition: dayzplayercamera_base.c:559
m_fUpDownAngleAdd
protected float m_fUpDownAngleAdd
up down angle in rad
Definition: dayzplayercamera1stperson.c:90
DayZPlayerCamera1stPerson
Definition: dayzplayercameravehicles.c:4
InitCameraOnPlayer
void InitCameraOnPlayer(bool force=false)
Definition: dayzplayercamera_base.c:541
DayZPlayerCameraResult
Definition: dayzplayer.c:11
OnUpdate
override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
Definition: dayzplayercamera1stperson.c:39
DayZPlayerCamera1stPersonUnconscious
class DayZPlayerCamera1stPerson extends DayZPlayerCameraBase DayZPlayerCamera1stPersonUnconscious(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera1stperson.c:104
m_fUpDownAngle
protected float m_fUpDownAngle
up down angle in rad
Definition: dayzplayercamera1stperson.c:89
HumanInputController
Definition: human.c:17
DayZPlayerCameraBase
this is main camera class
Definition: dayzplayercamera1stperson.c:4
m_CurrentCameraYaw
protected float m_CurrentCameraYaw
Definition: dayzplayercamera_base.c:558
GetBaseAngles
override vector GetBaseAngles()
Definition: dayzplayercamera1stperson.c:63
StdFovUpdate
void StdFovUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
Definition: dayzplayercamera_base.c:295
GetCurrentOrientation
vector GetCurrentOrientation()
Definition: dayzplayer.c:112
GetAdditiveAngles
override vector GetAdditiveAngles()
Definition: dayzplayercamera1stperson.c:72
Math3D
Definition: enmath3d.c:27
m_fLeftRightAngleAdd
protected float m_fLeftRightAngleAdd
left right angle in rad (in freelook only)
Definition: dayzplayercamera1stperson.c:92
UpdateCameraNV
void UpdateCameraNV(PlayerBase player)
Definition: dayzplayercamera_base.c:401