DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerCamera1stPerson.c File Reference

Go to the source code of this file.

Classes

class  DayZPlayerCameraBase
 this is main camera class More...
 

Functions

class DayZPlayerCamera1stPerson extends DayZPlayerCameraBase DayZPlayerCamera1stPersonUnconscious (DayZPlayer pPlayer, HumanInputController pInput)
 
void DayZPlayerCamera1stPerson (DayZPlayer pPlayer, HumanInputController pInput)
 
override void OnActivate (DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
 
override void OnUpdate (float pDt, out DayZPlayerCameraResult pOutResult)
 
override vector GetBaseAngles ()
 
override vector GetAdditiveAngles ()
 
override string GetCameraName ()
 

Variables

static const float CONST_UD_MIN = -85.0
 down limit
 
static const float CONST_UD_MAX = 85.0
 up limit
 
static const float CONST_LR_MIN = -160.0
 down limit
 
static const float CONST_LR_MAX = 160.0
 up limit
 
int m_iBoneIndex
 main bone
 
vector m_OffsetLS
 position offset
 
float m_fUpDownAngle
 up down angle in rad
 
float m_fUpDownAngleAdd
 up down angle in rad
 
float m_fLeftRightAngle
 left right angle in rad (in freelook only)
 
float m_fLeftRightAngleAdd
 left right angle in rad (in freelook only)
 

Function Documentation

◆ DayZPlayerCamera1stPerson()

void DayZPlayerCamera1stPersonUnconscious::DayZPlayerCamera1stPerson ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 110 of file DayZPlayerCamera1stPerson.c.

◆ DayZPlayerCamera1stPersonUnconscious()

class DayZPlayerCamera1stPerson extends DayZPlayerCameraBase DayZPlayerCamera1stPersonUnconscious ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 4 of file DayZPlayerCamera1stPerson.c.

103 {
104 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
105 }
int m_iBoneIndex
main bone

Referenced by DayZPlayerCameras::RegisterCameras().

◆ GetAdditiveAngles()

override vector DayZPlayerCamera1stPersonUnconscious::GetAdditiveAngles ( )

Definition at line 171 of file DayZPlayerCamera1stPerson.c.

175{
176 static const float CONST_UD_MIN = -85.0;
177 static const float CONST_UD_MAX = 85.0;
178
179 static const float CONST_LR_MIN = -160.0;
180 static const float CONST_LR_MAX = 160.0;
181
182
184 {
185 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
186 if (m_iBoneIndex == -1)
187 Print("DayZPlayerCamera1stPerson: main bone not found");
188
189 m_OffsetLS = "0.04 0.04 0"; //x - up, y - forward
190 }
191
192
193 //
195 {
197
198 if (pPrevCamera)
199 {
200 vector baseAngles = pPrevCamera.GetBaseAngles();
203
204 vector addAngles = pPrevCamera.GetAdditiveAngles();
207 }
208 }
209
210 //
211 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
212 {
216
219 pOutResult.m_CameraTM[3] = m_OffsetLS;
220
221 pOutResult.m_iDirectBone = m_iBoneIndex;
222 pOutResult.m_iDirectBoneMode = 1;
223 pOutResult.m_fUseHeading = 1.0;
224 pOutResult.m_fInsideCamera = 1.0;
225
226 pOutResult.m_fNearPlane = 0.04; //0.07 default
227
229
233 }
234
235 override vector GetBaseAngles()
236 {
237 vector a;
238 a[0] = m_fUpDownAngle;
239 a[1] = m_fLeftRightAngle;
240 a[2] = 0;
241 return a;
242 }
243
244 override vector GetAdditiveAngles()
245 {
246 vector a;
247 a[0] = m_fUpDownAngleAdd;
249 a[2] = 0;
250 return a;
251 }
252
253 override string GetCameraName()
254 {
255 return "DayZPlayerCamera1stPerson";
256 }
257
258 protected int m_iBoneIndex;
259 protected vector m_OffsetLS;
260
261 protected float m_fUpDownAngle;
262 protected float m_fUpDownAngleAdd;
263 protected float m_fLeftRightAngle;
264 protected float m_fLeftRightAngleAdd;
265}
266
267// *************************************************************************************
268// ! DayZPlayerCamera1stPersonUnconscious - first person only unconscious
269// *************************************************************************************
271{
273 {
274 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
275 }
276
277 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
278 {
279 super.OnUpdate(pDt, pOutResult);
280
281 pOutResult.m_iDirectBone = m_iBoneIndex;
282 pOutResult.m_iDirectBoneMode = 4;
283 pOutResult.m_fUseHeading = 0.0;
284
285 vector rot;
286 rot[0] = 0;
287 rot[1] = 90;
288 rot[2] = 0;
289
291 }
292}
void DayZPlayerCamera1stPerson(DayZPlayer pPlayer, HumanInputController pInput)
float m_fLeftRightAngle
left right angle in rad (in freelook only)
float m_fUpDownAngle
up down angle in rad
static const float CONST_UD_MAX
up limit
float m_fLeftRightAngleAdd
left right angle in rad (in freelook only)
float m_fUpDownAngleAdd
up down angle in rad
static const float CONST_LR_MIN
down limit
override vector GetBaseAngles()
static const float CONST_LR_MAX
up limit
static const float CONST_UD_MIN
down limit
override vector GetAdditiveAngles()
class DayZPlayerCamera1stPerson extends DayZPlayerCameraBase DayZPlayerCamera1stPersonUnconscious(DayZPlayer pPlayer, HumanInputController pInput)
vector m_OffsetLS
position offset
override string GetCameraName()
float UpdateLRAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
float m_CurrentCameraYaw
float m_CurrentCameraPitch
float UpdateUDAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
void StdFovUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
void InitCameraOnPlayer(bool force=false)
void UpdateCameraNV(PlayerBase player)
void ProcessCameraShake(float delta, out float leftRight, out float upDown)
DayZPlayer m_pPlayer
data
Definition dayzplayer.c:135
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
vector GetCurrentOrientation()
Definition dayzplayer.c:112
proto void Print(void var)
Prints content of variable to console/log.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
proto native void OnUpdate()
Definition tools.c:333
class HumanMovementState OnActivate()
HumanCommandScript fully scriptable command.
Definition human.c:1167

◆ GetBaseAngles()

override vector DayZPlayerCamera1stPersonUnconscious::GetBaseAngles ( )

Definition at line 162 of file DayZPlayerCamera1stPerson.c.

166{
167 static const float CONST_UD_MIN = -85.0;
168 static const float CONST_UD_MAX = 85.0;
169
170 static const float CONST_LR_MIN = -160.0;
171 static const float CONST_LR_MAX = 160.0;
172
173
175 {
176 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
177 if (m_iBoneIndex == -1)
178 Print("DayZPlayerCamera1stPerson: main bone not found");
179
180 m_OffsetLS = "0.04 0.04 0"; //x - up, y - forward
181 }
182
183
184 //
186 {
188
189 if (pPrevCamera)
190 {
191 vector baseAngles = pPrevCamera.GetBaseAngles();
194
195 vector addAngles = pPrevCamera.GetAdditiveAngles();
198 }
199 }
200
201 //
202 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
203 {
207
210 pOutResult.m_CameraTM[3] = m_OffsetLS;
211
212 pOutResult.m_iDirectBone = m_iBoneIndex;
213 pOutResult.m_iDirectBoneMode = 1;
214 pOutResult.m_fUseHeading = 1.0;
215 pOutResult.m_fInsideCamera = 1.0;
216
217 pOutResult.m_fNearPlane = 0.04; //0.07 default
218
220
224 }
225
226 override vector GetBaseAngles()
227 {
228 vector a;
229 a[0] = m_fUpDownAngle;
230 a[1] = m_fLeftRightAngle;
231 a[2] = 0;
232 return a;
233 }
234
235 override vector GetAdditiveAngles()
236 {
237 vector a;
238 a[0] = m_fUpDownAngleAdd;
240 a[2] = 0;
241 return a;
242 }
243
244 override string GetCameraName()
245 {
246 return "DayZPlayerCamera1stPerson";
247 }
248
249 protected int m_iBoneIndex;
250 protected vector m_OffsetLS;
251
252 protected float m_fUpDownAngle;
253 protected float m_fUpDownAngleAdd;
254 protected float m_fLeftRightAngle;
255 protected float m_fLeftRightAngleAdd;
256}
257
258// *************************************************************************************
259// ! DayZPlayerCamera1stPersonUnconscious - first person only unconscious
260// *************************************************************************************
262{
264 {
265 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
266 }
267
268 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
269 {
270 super.OnUpdate(pDt, pOutResult);
271
272 pOutResult.m_iDirectBone = m_iBoneIndex;
273 pOutResult.m_iDirectBoneMode = 4;
274 pOutResult.m_fUseHeading = 0.0;
275
276 vector rot;
277 rot[0] = 0;
278 rot[1] = 90;
279 rot[2] = 0;
280
282 }
283}

◆ GetCameraName()

override string DayZPlayerCamera1stPersonUnconscious::GetCameraName ( )

Definition at line 180 of file DayZPlayerCamera1stPerson.c.

184{
185 static const float CONST_UD_MIN = -85.0;
186 static const float CONST_UD_MAX = 85.0;
187
188 static const float CONST_LR_MIN = -160.0;
189 static const float CONST_LR_MAX = 160.0;
190
191
193 {
194 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
195 if (m_iBoneIndex == -1)
196 Print("DayZPlayerCamera1stPerson: main bone not found");
197
198 m_OffsetLS = "0.04 0.04 0"; //x - up, y - forward
199 }
200
201
202 //
204 {
206
207 if (pPrevCamera)
208 {
209 vector baseAngles = pPrevCamera.GetBaseAngles();
212
213 vector addAngles = pPrevCamera.GetAdditiveAngles();
216 }
217 }
218
219 //
220 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
221 {
225
228 pOutResult.m_CameraTM[3] = m_OffsetLS;
229
230 pOutResult.m_iDirectBone = m_iBoneIndex;
231 pOutResult.m_iDirectBoneMode = 1;
232 pOutResult.m_fUseHeading = 1.0;
233 pOutResult.m_fInsideCamera = 1.0;
234
235 pOutResult.m_fNearPlane = 0.04; //0.07 default
236
238
242 }
243
244 override vector GetBaseAngles()
245 {
246 vector a;
247 a[0] = m_fUpDownAngle;
248 a[1] = m_fLeftRightAngle;
249 a[2] = 0;
250 return a;
251 }
252
253 override vector GetAdditiveAngles()
254 {
255 vector a;
256 a[0] = m_fUpDownAngleAdd;
258 a[2] = 0;
259 return a;
260 }
261
262 override string GetCameraName()
263 {
264 return "DayZPlayerCamera1stPerson";
265 }
266
267 protected int m_iBoneIndex;
268 protected vector m_OffsetLS;
269
270 protected float m_fUpDownAngle;
271 protected float m_fUpDownAngleAdd;
272 protected float m_fLeftRightAngle;
273 protected float m_fLeftRightAngleAdd;
274}
275
276// *************************************************************************************
277// ! DayZPlayerCamera1stPersonUnconscious - first person only unconscious
278// *************************************************************************************
280{
282 {
283 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
284 }
285
286 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
287 {
288 super.OnUpdate(pDt, pOutResult);
289
290 pOutResult.m_iDirectBone = m_iBoneIndex;
291 pOutResult.m_iDirectBoneMode = 4;
292 pOutResult.m_fUseHeading = 0.0;
293
294 vector rot;
295 rot[0] = 0;
296 rot[1] = 90;
297 rot[2] = 0;
298
300 }
301}

◆ OnActivate()

override void DayZPlayerCamera1stPersonUnconscious::OnActivate ( DayZPlayerCamera pPrevCamera,
DayZPlayerCameraResult pPrevCameraResult )

Definition at line 121 of file DayZPlayerCamera1stPerson.c.

◆ OnUpdate()

override void DayZPlayerCamera1stPersonUnconscious::OnUpdate ( float pDt,
out DayZPlayerCameraResult pOutResult )

update angles from input

Definition at line 138 of file DayZPlayerCamera1stPerson.c.

142{
143 static const float CONST_UD_MIN = -85.0;
144 static const float CONST_UD_MAX = 85.0;
145
146 static const float CONST_LR_MIN = -160.0;
147 static const float CONST_LR_MAX = 160.0;
148
149
151 {
152 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
153 if (m_iBoneIndex == -1)
154 Print("DayZPlayerCamera1stPerson: main bone not found");
155
156 m_OffsetLS = "0.04 0.04 0"; //x - up, y - forward
157 }
158
159
160 //
162 {
164
165 if (pPrevCamera)
166 {
167 vector baseAngles = pPrevCamera.GetBaseAngles();
170
171 vector addAngles = pPrevCamera.GetAdditiveAngles();
174 }
175 }
176
177 //
178 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
179 {
183
186 pOutResult.m_CameraTM[3] = m_OffsetLS;
187
188 pOutResult.m_iDirectBone = m_iBoneIndex;
189 pOutResult.m_iDirectBoneMode = 1;
190 pOutResult.m_fUseHeading = 1.0;
191 pOutResult.m_fInsideCamera = 1.0;
192
193 pOutResult.m_fNearPlane = 0.04; //0.07 default
194
196
200 }
201
202 override vector GetBaseAngles()
203 {
204 vector a;
205 a[0] = m_fUpDownAngle;
206 a[1] = m_fLeftRightAngle;
207 a[2] = 0;
208 return a;
209 }
210
211 override vector GetAdditiveAngles()
212 {
213 vector a;
214 a[0] = m_fUpDownAngleAdd;
216 a[2] = 0;
217 return a;
218 }
219
220 override string GetCameraName()
221 {
222 return "DayZPlayerCamera1stPerson";
223 }
224
225 protected int m_iBoneIndex;
226 protected vector m_OffsetLS;
227
228 protected float m_fUpDownAngle;
229 protected float m_fUpDownAngleAdd;
230 protected float m_fLeftRightAngle;
231 protected float m_fLeftRightAngleAdd;
232}
233
234// *************************************************************************************
235// ! DayZPlayerCamera1stPersonUnconscious - first person only unconscious
236// *************************************************************************************
238{
240 {
241 m_iBoneIndex = pPlayer.GetBoneIndexByName("Head");
242 }
243
244 override void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
245 {
246 super.OnUpdate(pDt, pOutResult);
247
248 pOutResult.m_iDirectBone = m_iBoneIndex;
249 pOutResult.m_iDirectBoneMode = 4;
250 pOutResult.m_fUseHeading = 0.0;
251
252 vector rot;
253 rot[0] = 0;
254 rot[1] = 90;
255 rot[2] = 0;
256
258 }
259}

Variable Documentation

◆ CONST_LR_MAX

const float CONST_LR_MAX = 160.0
static

◆ CONST_LR_MIN

const float CONST_LR_MIN = -160.0
static

◆ CONST_UD_MAX

const float CONST_UD_MAX = 85.0
static

◆ CONST_UD_MIN

const float CONST_UD_MIN = -85.0
static

◆ m_fLeftRightAngle

float m_fLeftRightAngle
protected

left right angle in rad (in freelook only)

Definition at line 190 of file DayZPlayerCamera1stPerson.c.

Referenced by DayZPlayerCameraBase::OnActivate(), OnActivate(), DayZPlayerCameraBase::OnUpdate(), and OnUpdate().

◆ m_fLeftRightAngleAdd

float m_fLeftRightAngleAdd
protected

left right angle in rad (in freelook only)

Definition at line 191 of file DayZPlayerCamera1stPerson.c.

Referenced by DayZPlayerCameraBase::OnActivate(), OnActivate(), DayZPlayerCameraBase::OnUpdate(), and OnUpdate().

◆ m_fUpDownAngle

float m_fUpDownAngle
protected

◆ m_fUpDownAngleAdd

float m_fUpDownAngleAdd
protected

◆ m_iBoneIndex

◆ m_OffsetLS

vector m_OffsetLS
protected