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

Go to the source code of this file.

Enumerations

enum  NVTypes {
  NONE = 0 , NV_GOGGLES , NV_GOGGLES_OFF , NV_OPTICS_ON ,
  NV_OPTICS_OFF , NV_PUMPKIN , NV_OPTICS_KAZUAR_DAY , NV_OPTICS_KAZUAR_NIGHT ,
  NV_OPTICS_STARLIGHT_DAY , NV_OPTICS_STARLIGHT_NIGHT , MAX
}
 

Functions

float Limit (float pV, float pMin, float pMax)
 limit function
 
float fixAngle_PI_PI (float pAngle)
 
float fixAngle_180_180 (float pAngle)
 
void DayZPlayerCameraBase (DayZPlayer pPlayer, HumanInputController pInput)
 constructor must be same
 
void HandleShoulderCameraOverride (HumanInputController pInput)
 
void ProcessCameraShake (float delta, out float leftRight, out float upDown)
 
void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
float UpdateUDAngleUnlocked (out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
 
float UpdateLRAngleUnlocked (out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
 
float UpdateUDAngle (out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
 
float UpdateLRAngle (float pAngle, float pMin, float pMax, float pDt)
 
void StdFovUpdate (float pDt, out DayZPlayerCameraResult pOutResult)
 
override void SpawnCameraShakeProper (float strength, float radius, float smoothness, float radius_decay_speed)
 
override void OnUpdate (float pDt, out DayZPlayerCameraResult pOutResult)
 
override void OnActivate (DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
 
float GetWeaponSwayModifier ()
 
override string GetCameraName ()
 
void SetCameraPPDelay (DayZPlayerCamera pPrevCamera)
 
void SetCameraNV (bool nightvision)
 
bool IsCameraNV ()
 
void SetCameraNVType (int type)
 
int GetCameraNVType ()
 
void UpdateCameraNV (PlayerBase player)
 
void SetCameraPP (bool state, DayZPlayerCamera launchedFrom)
 by default sets camera PP to zero, regardless of parameter. Override if needed.
 
override float GetCurrentYaw ()
 
override float GetCurrentPitch ()
 
override float GetCurrentRoll ()
 
void ForceFreelook (bool state)
 
void SetNVPostprocess (int NVtype)
 DayZPlayerCameraOptics handles this separately, otherwise it takes active NVType from PlayerBase::GetCameraNVType.
 
void InitCameraOnPlayer (bool force=false)
 

Variables

enum NVTypes CONST_NEARPLANE_OPTICS_MIN = 0.04
 
Weapon_Base m_weaponUsed
 
ItemOptics m_opticsUsed
 
ref CameraShake m_CameraShake
 
float m_fLRAngleVel [1]
 
float m_fUDAngleVel [1]
 
float m_fFovAbsVel [1]
 
float m_fFovAbsolute
 
bool m_bForceFreeLook
 
float m_WeaponSwayModifier
 
float m_CameraPPDelay
 
float m_CurrentCameraYaw
 
float m_CurrentCameraPitch
 
float m_CurrentCameraRoll
 
HumanCommandWeapons m_CommandWeapons
 
bool m_IsNightvision
 
int m_NightvisionType
 

Enumeration Type Documentation

◆ NVTypes

Enumerator
NONE 
NV_GOGGLES 
NV_GOGGLES_OFF 
NV_OPTICS_ON 
NV_OPTICS_OFF 
NV_PUMPKIN 
NV_OPTICS_KAZUAR_DAY 
NV_OPTICS_KAZUAR_NIGHT 
NV_OPTICS_STARLIGHT_DAY 
NV_OPTICS_STARLIGHT_NIGHT 
MAX 

Definition at line 40 of file DayZPlayerCamera_Base.c.

Function Documentation

◆ DayZPlayerCameraBase()

void DayZPlayerCameraBase ( DayZPlayer pPlayer,
HumanInputController pInput )
protected

constructor must be same

Definition at line 64 of file DayZPlayerCamera_Base.c.

65 {
66 m_fLRAngleVel[0] = 0;
67 m_fUDAngleVel[0] = 0;
68 m_fFovAbsVel[0] = 0;
70
73 /*
74 {
75 int perItemCamUD = pPlayer.GetCurrentPerItemCameraUD();
76 string a = "Per Item Camera User Data: " + perItemCamUD.ToString();
77 Print(a);
78 }
79 */
81
82 m_CommandWeapons = pPlayer.GetCommandModifier_Weapons();
83 Init();
85 };
DayZGame GetDayZGame()
Definition DayZGame.c:3530
float m_fUDAngleVel[1]
void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
float m_CameraPPDelay
void HandleShoulderCameraOverride(HumanInputController pInput)
float m_WeaponSwayModifier
float m_fFovAbsVel[1]
HumanCommandWeapons m_CommandWeapons
float m_fFovAbsolute
float m_fLRAngleVel[1]
override int GetEyeZoomLevel()
DayZPlayer m_pPlayer
data
Definition dayzplayer.c:135

References GetDayZGame(), DayZPlayer::GetEyeZoomLevel(), HandleShoulderCameraOverride(), Init(), m_CameraPPDelay, m_CommandWeapons, m_fFovAbsolute, m_fFovAbsVel, m_fLRAngleVel, m_fUDAngleVel, m_pPlayer, and m_WeaponSwayModifier.

◆ fixAngle_180_180()

float fixAngle_180_180 ( float pAngle)

Definition at line 26 of file DayZPlayerCamera_Base.c.

27{
28 while (pAngle > 180)
29
30 pAngle -= 360;
31
32 while (pAngle < -180)
33
34 pAngle += 360;
35
36 return pAngle;
37}

Referenced by UIScriptedMenu::SetCameraData().

◆ fixAngle_PI_PI()

float fixAngle_PI_PI ( float pAngle)

Definition at line 13 of file DayZPlayerCamera_Base.c.

14{
15 while (pAngle > Math.PI)
16
17 pAngle -= Math.PI2;
18
19 while (pAngle < -Math.PI)
20
21 pAngle += Math.PI2;
22
23 return pAngle;
24}
Definition EnMath.c:7
static const float PI2
Definition EnMath.c:13
static const float PI
Definition EnMath.c:12

References Math::PI, and Math::PI2.

◆ ForceFreelook()

void ForceFreelook ( bool state)
protected

Definition at line 417 of file DayZPlayerCamera_Base.c.

418 {
420 }
bool m_bForceFreeLook

References m_bForceFreeLook.

◆ GetCameraName()

override string GetCameraName ( )
protected

Definition at line 345 of file DayZPlayerCamera_Base.c.

346 {
347 return "DayZPlayerCameraBase";
348 }

◆ GetCameraNVType()

int GetCameraNVType ( )
protected

Definition at line 369 of file DayZPlayerCamera_Base.c.

370 {
371 return m_NightvisionType;
372 }
int m_NightvisionType

References m_NightvisionType.

Referenced by SetCameraPP(), DayZPlayerCameraBase::SetCameraPP(), and UpdateCameraNV().

◆ GetCurrentPitch()

override float GetCurrentPitch ( )
protected

Definition at line 407 of file DayZPlayerCamera_Base.c.

408 {
410 }
float m_CurrentCameraPitch

References m_CurrentCameraPitch.

◆ GetCurrentRoll()

override float GetCurrentRoll ( )
protected

Definition at line 412 of file DayZPlayerCamera_Base.c.

413 {
414 return m_CurrentCameraRoll;
415 }
float m_CurrentCameraRoll

References m_CurrentCameraRoll.

◆ GetCurrentYaw()

override float GetCurrentYaw ( )
protected

Definition at line 402 of file DayZPlayerCamera_Base.c.

403 {
404 return m_CurrentCameraYaw;
405 }
float m_CurrentCameraYaw

References m_CurrentCameraYaw.

◆ GetWeaponSwayModifier()

float GetWeaponSwayModifier ( )
protected

Definition at line 340 of file DayZPlayerCamera_Base.c.

341 {
343 }

References m_WeaponSwayModifier.

◆ HandleShoulderCameraOverride()

void HandleShoulderCameraOverride ( HumanInputController pInput)
protected

disable override

Definition at line 88 of file DayZPlayerCamera_Base.c.

89 {
92 }
proto native void Override3rdIsRightShoulder(HumanInputControllerOverrideType overrideType, bool value)
HumanInputController m_pInput
human input
Definition dayzplayer.c:136
HumanInputControllerOverrideType
Definition human.c:8

References m_pInput, and HumanInputController::Override3rdIsRightShoulder().

Referenced by DayZPlayerCameraBase().

◆ Init()

void Init ( )
protected

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

pre-init arrays

Definition at line 105 of file DayZPlayerCamera_Base.c.

106 {
108 if (player && player.IsNVGWorking() != IsCameraNV())
109 {
110 SetCameraNV(player.IsNVGWorking());
111 SetCameraNVType(player.GetNVType());
112 }
113 }
bool IsCameraNV()
void SetCameraNV(bool nightvision)
void SetCameraNVType(int type)

References IsCameraNV(), m_pPlayer, SetCameraNV(), and SetCameraNVType().

◆ InitCameraOnPlayer()

void InitCameraOnPlayer ( bool force = false)
protected

Definition at line 506 of file DayZPlayerCamera_Base.c.

507 {
509 if (!player.GetCurrentPlayerCamera() || (force && player.GetCurrentPlayerCamera() != this))
510 player.OnCameraChanged(this);
511 }

References m_pPlayer.

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

◆ IsCameraNV()

bool IsCameraNV ( )
protected

Definition at line 359 of file DayZPlayerCamera_Base.c.

360 {
361 return m_IsNightvision;
362 }
bool m_IsNightvision

References m_IsNightvision.

Referenced by Init(), OnActivate(), SetCameraPP(), DayZPlayerCameraBase::SetCameraPP(), and UpdateCameraNV().

◆ Limit()

float Limit ( float pV,
float pMin,
float pMax )

limit function

Definition at line 2 of file DayZPlayerCamera_Base.c.

3{
4 if (pV >= pMin && pV <= pMax)
5 return pV;
6 else if (pV < pMin)
7 return pMin;
8 else
9 return pMax;
10}

Referenced by UpdateLRAngle(), UpdateLRAngleLookAt(), UpdateLRAngleUnlocked(), UpdateUDAngle(), and UpdateUDAngleUnlocked().

◆ OnActivate()

override void OnActivate ( DayZPlayerCamera pPrevCamera,
DayZPlayerCameraResult pPrevCameraResult )
protected

Definition at line 326 of file DayZPlayerCamera_Base.c.

327 {
328 InitCameraOnPlayer(true);
330
331 if (DayZPlayerCameraBase.Cast(pPrevCamera) && DayZPlayerCameraBase.Cast(pPrevCamera).IsCameraNV() && !IsCameraNV())
332 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_TRANSITIVE));
333
334 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(SetCameraPP, m_CameraPPDelay * 1000, false, true, this); // this takes care of weapon/optics postprocessing
337 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(PlayerBase.Cast(m_pPlayer).HideClothing, null, false);
338 }
void InitCameraOnPlayer(bool force=false)
void SetCameraPP(bool state, DayZPlayerCamera launchedFrom)
by default sets camera PP to zero, regardless of parameter. Override if needed.
void SetCameraPPDelay(DayZPlayerCamera pPrevCamera)
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
this is main camera class
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9

References CALL_CATEGORY_GUI, DayZPlayerCamera(), DayZPlayerCameraOptics(), GetGame(), InitCameraOnPlayer(), IsCameraNV(), m_CameraPPDelay, m_pPlayer, DayZPlayerCameraBase::SetCameraPP(), and DayZPlayerCameraBase::SetCameraPPDelay().

◆ OnUpdate()

override void OnUpdate ( float pDt,
out DayZPlayerCameraResult pOutResult )
protected

Definition at line 306 of file DayZPlayerCamera_Base.c.

307 {
308 if (!m_pPlayer || !PlayerBase.Cast(m_pPlayer))
309 {
310 Debug.Log("DayZPlayerCameraBase | OnUpdate | no player!");
311 return;
312 }
313
314 if (PlayerBase.Cast(m_pPlayer).GetCurrentCamera() != this)
315 {
316 //Print("DayZPlayerCameraBase | OnUpdate | unused camera! | " + this + "/" + PlayerBase.Cast(m_pPlayer).GetCurrentCamera());
317 return;
318 }
319
320 super.OnUpdate(pDt, pOutResult);
324 }
void StdFovUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
void UpdateCameraNV(PlayerBase player)
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133

References InitCameraOnPlayer(), Debug::Log(), m_pPlayer, StdFovUpdate(), and UpdateCameraNV().

◆ ProcessCameraShake()

void ProcessCameraShake ( float delta,
out float leftRight,
out float upDown )
protected

Definition at line 94 of file DayZPlayerCamera_Base.c.

95 {
96 if (m_CameraShake)
97 {
98 float x, y;
99 m_CameraShake.Update(delta, x, y);
100 leftRight += x;
101 upDown += y;
102 }
103 }
ref CameraShake m_CameraShake
Icon x
Icon y

References m_CameraShake, x, and y.

Referenced by DayZPlayerCameraBase::OnUpdate().

◆ SetCameraNV()

void SetCameraNV ( bool nightvision)
protected

Definition at line 354 of file DayZPlayerCamera_Base.c.

355 {
357 }

References m_IsNightvision.

Referenced by Init(), SetCameraPP(), and UpdateCameraNV().

◆ SetCameraNVType()

void SetCameraNVType ( int type)
protected

Definition at line 364 of file DayZPlayerCamera_Base.c.

365 {
366 m_NightvisionType = type;
367 }

References m_NightvisionType.

Referenced by Init(), and UpdateCameraNV().

◆ SetCameraPP()

void SetCameraPP ( bool state,
DayZPlayerCamera launchedFrom )
protected

by default sets camera PP to zero, regardless of parameter. Override if needed.

Definition at line 388 of file DayZPlayerCamera_Base.c.

389 {
390 PPERequesterBank.GetRequester(PPERequester_CameraADS).Stop();
391
392 if (IsCameraNV())
394 else
396
397 m_weaponUsed = Weapon_Base.Cast(m_pPlayer.GetHumanInventory().GetEntityInHands());
398 if (m_weaponUsed)
399 m_weaponUsed.HideWeaponBarrel(false);
400 }
Weapon_Base m_weaponUsed
void SetNVPostprocess(int NVtype)
DayZPlayerCameraOptics handles this separately, otherwise it takes active NVType from PlayerBase::Get...
int GetCameraNVType()

References GetCameraNVType(), IsCameraNV(), m_pPlayer, m_weaponUsed, and SetNVPostprocess().

◆ SetCameraPPDelay()

void SetCameraPPDelay ( DayZPlayerCamera pPrevCamera)
protected

Definition at line 350 of file DayZPlayerCamera_Base.c.

351 {
352 }

◆ SetNVPostprocess()

void SetNVPostprocess ( int NVtype)
protected

DayZPlayerCameraOptics handles this separately, otherwise it takes active NVType from PlayerBase::GetCameraNVType.

Definition at line 424 of file DayZPlayerCamera_Base.c.

425 {
426 //Print("+++Setting NV type: " + NVtype + " +++");
427 switch (NVtype)
428 {
429 case NVTypes.NONE:
430 {
431 PPERequesterBank.GetRequester(PPERequester_CameraNV).Stop();
432 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
433 {
434 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
435 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
436 }
437 }
438 break;
439
440 //night-vision modes
441 case NVTypes.NV_OPTICS_KAZUAR_NIGHT:
442 case NVTypes.NV_OPTICS_STARLIGHT_NIGHT:
443 case NVTypes.NV_OPTICS_ON:
444 {
445 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_DEFAULT_OPTICS));
446 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
447 {
448 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
449 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
450 }
451 }
452 break;
453
454 //daytime filter modes
455 case NVTypes.NV_OPTICS_KAZUAR_DAY:
456 case NVTypes.NV_OPTICS_STARLIGHT_DAY:
457 {
458 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_DAYTIME_OPTICS));
459 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
460 {
461 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
462 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
463 }
464 }
465 break;
466
467 case NVTypes.NV_GOGGLES_OFF:
468 case NVTypes.NV_OPTICS_OFF:
469 {
470 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_NO_BATTERY));
471 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
472 {
473 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
474 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
475 }
476 }
477 break;
478
479 case NVTypes.NV_GOGGLES:
480 {
481 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_DEFAULT_GLASSES));
482 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
483 {
484 GetGame().GetMission().GetEffectWidgets().AddActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
485 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
486 }
487 }
488 break;
489
490 case NVTypes.NV_PUMPKIN:
491 {
492 PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV).Start(new Param1<int>(PPERequester_CameraNV.NV_PUMPKIN));
493 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
494 {
495 GetGame().GetMission().GetEffectWidgets().AddActiveEffects({EffectWidgetsTypes.PUMPKIN_OCCLUDER});
496 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.NVG_OCCLUDER});
497 }
498 }
499 break;
500 }
501
502 if (PlayerBaseClient.Cast(m_pPlayer))
503 PlayerBaseClient.Cast(m_pPlayer).SwitchPersonalLight(NVtype < 1);
504 }

References GetGame(), and m_pPlayer.

Referenced by SetCameraPP(), and DayZPlayerCameraBase::SetCameraPP().

◆ SpawnCameraShakeProper()

override void SpawnCameraShakeProper ( float strength,
float radius,
float smoothness,
float radius_decay_speed )
protected

Definition at line 301 of file DayZPlayerCamera_Base.c.

References m_CameraShake.

Referenced by SpawnCameraShake(), and SpawnDiagCameraShake().

◆ StdFovUpdate()

void StdFovUpdate ( float pDt,
out DayZPlayerCameraResult pOutResult )
protected

change abs FOV for naked eye zoom

switch shooting from camera to weapon (firearms)

Definition at line 274 of file DayZPlayerCamera_Base.c.

275 {
277 switch (m_pPlayer.GetEyeZoomLevel())
278 {
279 // ordered in likelihood of occurance for perf. reasons
280 case ECameraZoomType.NONE:
281 m_fFovAbsolute = Math.SmoothCD(m_fFovAbsolute, GetDayZGame().GetFOVByZoomType(ECameraZoomType.NONE), m_fFovAbsVel, 0.1, 1000, pDt);
282 break;
283 case ECameraZoomType.NORMAL:
284 m_fFovAbsolute = Math.SmoothCD(m_fFovAbsolute, GetDayZGame().GetFOVByZoomType(ECameraZoomType.NORMAL), m_fFovAbsVel, 0.1, 1000, pDt);
285 break;
286 case ECameraZoomType.SHALLOW:
287 m_fFovAbsolute = Math.SmoothCD(m_fFovAbsolute, GetDayZGame().GetFOVByZoomType(ECameraZoomType.SHALLOW), m_fFovAbsVel, 0.1, 1000, pDt);
288 break;
289 default:
290 m_fFovAbsolute = Math.SmoothCD(m_fFovAbsolute, GetDayZGame().GetFOVByZoomType(ECameraZoomType.NONE), m_fFovAbsVel, 0.1, 1000, pDt);
291 break;
292 }
293
294 pOutResult.m_fFovAbsolute = m_fFovAbsolute;
295
298 pOutResult.m_fShootFromCamera = 0.0;
299 }
ECameraZoomType
override bool IsShootingFromCamera()
static proto float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Does the CD smoothing function - easy in | easy out / S shaped smoothing.

References GetDayZGame(), DayZPlayer::GetEyeZoomLevel(), DayZPlayer::IsShootingFromCamera(), m_fFovAbsolute, m_fFovAbsVel, m_pPlayer, and Math::SmoothCD().

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

◆ UpdateCameraNV()

void UpdateCameraNV ( PlayerBase player)
protected

Definition at line 374 of file DayZPlayerCamera_Base.c.

375 {
376 if (!player)
377 return;
378
379 if (player.IsNVGWorking() != IsCameraNV() || player.GetNVType() != GetCameraNVType())
380 {
381 SetCameraNV(player.IsNVGWorking());
382 SetCameraNVType(player.GetNVType());
383 SetCameraPP(true, this);
384 }
385 }

References GetCameraNVType(), IsCameraNV(), SetCameraNV(), SetCameraNVType(), and DayZPlayerCameraBase::SetCameraPP().

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

◆ UpdateLRAngle()

float UpdateLRAngle ( float pAngle,
float pMin,
float pMax,
float pDt )
protected

lr angle

Definition at line 241 of file DayZPlayerCamera_Base.c.

242 {
245 {
249
250 m_fLRAngleVel[0] = 0; // reset filter
251
252 }
253 else
254 {
256 {
259
260 m_fLRAngleVel[0] = 0; // reset filter
261 }
262 else
263 {
264 // smooth value back to 0
265 pAngle = Math.SmoothCD(pAngle, 0, m_fLRAngleVel, 0.14, 1000, pDt);
266 // m_fLeftRightAngle = 0.9 * (1.0 - pDt);
267 }
268 }
269
270 return pAngle;
271 }
float Limit(float pV, float pMin, float pMax)
limit function
proto native bool CameraIsFreeLook()
returns true if freelook is active
proto native vector GetAimChange()
returns per tick aim change (in radians)
proto native bool CameraIsTracking()
returns if camera is tracking (using IR device)
proto native vector GetTracking()
returns absolute tracking change (in radians)
static const float RAD2DEG
Definition EnMath.c:16

References HumanInputController::CameraIsFreeLook(), HumanInputController::CameraIsTracking(), HumanInputController::GetAimChange(), HumanInputController::GetTracking(), Limit(), m_bForceFreeLook, m_fLRAngleVel, m_pInput, Math::RAD2DEG, and Math::SmoothCD().

◆ UpdateLRAngleUnlocked()

float UpdateLRAngleUnlocked ( out float pAngle,
out float pAngleAdd,
float pMin,
float pMax,
float pDt )
protected

Definition at line 152 of file DayZPlayerCamera_Base.c.

153 {
154 float target = 0;
155
157 {
159 pAngle = target;
160
161 m_fUDAngleVel[0] = 0;
162 }
163 else
164 {
165 if (Math.AbsFloat(pAngleAdd) > 0.001)
166 {
168 pAngle = target;
169 }
170
172 {
174
175 m_fLRAngleVel[0] = 0;
176 }
177 else
178 pAngleAdd = Math.SmoothCD(pAngleAdd, 0.0, m_fLRAngleVel, 0.14, 1000, pDt);
179
181 }
182
185
186 return pAngle + pAngleAdd;
187 }
proto native vector GetAimDelta(float dt)
returns aim change (in radians)
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), HumanInputController::CameraIsFreeLook(), HumanInputController::CameraIsTracking(), HumanInputController::GetAimDelta(), HumanInputController::GetTracking(), Limit(), m_bForceFreeLook, m_fLRAngleVel, m_fUDAngleVel, m_pInput, Math::RAD2DEG, and Math::SmoothCD().

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

◆ UpdateUDAngle()

float UpdateUDAngle ( out float pAngle,
out float pAngleAdd,
float pMin,
float pMax,
float pDt )
protected

pAngle + pAngleAdd == aimingUDAngle + aimingUDAdd now we set pAngleAdd to be the differenc from aimingAngle and we change camera angle to be the aiming angle

lr angle

update it in degrees

Definition at line 189 of file DayZPlayerCamera_Base.c.

190 {
191 if (Math.AbsFloat(pAngleAdd) > 0.001)
192 {
194
197
198 // override actual angle
201
202 // Print("Angle: " + pAngle.ToString() + " Aim: " + actualUDAngle.ToString() );
203 }
204
207 {
210
211 m_fUDAngleVel[0] = 0;
212 }
213 else
214 {
216 {
219
220 m_fUDAngleVel[0] = 0;
221 }
222 else
223 {
227
228 pAngleAdd = Math.SmoothCD(pAngleAdd, 0, m_fUDAngleVel, 0.14, 1000, pDt);
229 }
230 }
231
232 /*{
233 float change = m_pInput.GetAimChange()[1] * Math.RAD2DEG;
234
235 Print ("Script: Camera ud angle: " + pAngle.ToString() + " change: " + change.ToString() );
236 }*/
237
238 return Limit(pAngle + pAngleAdd, pMin, pMax);
239 }
proto native float GetBaseAimingAngleUD()
returns base aiming angle UD - without sway/offsets/...

References Math::AbsFloat(), HumanInputController::CameraIsFreeLook(), HumanInputController::CameraIsTracking(), HumanInputController::GetAimChange(), HumanCommandWeapons::GetBaseAimingAngleUD(), HumanInputController::GetTracking(), Limit(), m_CommandWeapons, m_fUDAngleVel, m_pInput, Math::RAD2DEG, and Math::SmoothCD().

◆ UpdateUDAngleUnlocked()

Variable Documentation

◆ CONST_NEARPLANE_OPTICS_MIN

enum NVTypes CONST_NEARPLANE_OPTICS_MIN = 0.04

◆ m_bForceFreeLook

bool m_bForceFreeLook
protected

◆ m_CameraPPDelay

float m_CameraPPDelay
protected

◆ m_CameraShake

ref CameraShake m_CameraShake
protected

◆ m_CommandWeapons

HumanCommandWeapons m_CommandWeapons
protected

◆ m_CurrentCameraPitch

float m_CurrentCameraPitch
protected

◆ m_CurrentCameraRoll

float m_CurrentCameraRoll
protected

◆ m_CurrentCameraYaw

float m_CurrentCameraYaw
protected

◆ m_fFovAbsolute

float m_fFovAbsolute
protected

Definition at line 516 of file DayZPlayerCamera_Base.c.

◆ m_fFovAbsVel

◆ m_fLRAngleVel

float m_fLRAngleVel[1]
protected

◆ m_fUDAngleVel

float m_fUDAngleVel[1]
protected

◆ m_IsNightvision

bool m_IsNightvision
protected

Definition at line 526 of file DayZPlayerCamera_Base.c.

Referenced by IsCameraNV(), and SetCameraNV().

◆ m_NightvisionType

int m_NightvisionType
protected

Definition at line 527 of file DayZPlayerCamera_Base.c.

Referenced by GetCameraNVType(), and SetCameraNVType().

◆ m_opticsUsed

◆ m_WeaponSwayModifier

◆ m_weaponUsed