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

Go to the source code of this file.

Classes

class  DayZPlayerCameraBase
 this is main camera class More...
 
class  DayZPlayerCamera3rdPersonErc
 
class  DayZPlayerCamera3rdPersonErcRaised
 
class  DayZPlayerCamera3rdPersonCrouch
 
class  DayZPlayerCamera3rdPersonProneBase
 

Functions

class DayZPlayerCamera3rdPerson extends DayZPlayerCameraBase DayZPlayerCamera3rdPersonErc (DayZPlayer pPlayer, HumanInputController pInput)
 
void DayZPlayerCamera3rdPerson (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 ()
 
class DayZPlayerCamera3rdPersonJump extends DayZPlayerCamera3rdPersonErc DayZPlayerCamera3rdPersonClimb (DayZPlayer pPlayer, HumanInputController pInput)
 
void DayZPlayerCamera3rdPersonJump (DayZPlayer pPlayer, HumanInputController pInput)
 
class DayZPlayerCamera3rdPersonErcSpr extends DayZPlayerCamera3rdPersonErc DayZPlayerCamera3rdPersonErcRaised (DayZPlayer pPlayer, HumanInputController pInput)
 
void DayZPlayerCamera3rdPersonErcSpr (DayZPlayer pPlayer, HumanInputController pInput)
 
override bool IsCamera3rdRaised ()
 
void DayZPlayerCamera3rdPersonCrouch (DayZPlayer pPlayer, HumanInputController pInput)
 
float UpdateLRAngleLookAt (float pMin, float pMax, float pDt)
 
class DayZPlayerCamera3rdPersonProne extends DayZPlayerCamera3rdPersonProneBase DayZPlayerCamera3rdPersonProneRaised (DayZPlayer pPlayer, HumanInputController pInput)
 
void DayZPlayerCamera3rdPersonProne (DayZPlayer pPlayer, HumanInputController pInput)
 

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 = -1
 runtime config
 
vector m_CameraOffsetMS
 model space offset
 
vector m_CameraOffsetLS
 local space offset
 
float m_fDistance
 distance from start
 
float m_fShoulderWidth
 shoulder camera widths
 
bool m_bShoulderInLS
 true - shoulder is in local space
 
float m_fRoll
 camera roll (deprecated)
 
float m_fLeanDistance
 shift on leaning
 
float m_fUpDownAngle
 runtime values
 
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)
 
float m_fCameraLRShoulder
 shoulder offsets
 
float m_fCameraLRShoulderVel [1]
 
float m_fPredictCollisionRadius
 collision prediction
 
ref HumanMovementState m_MovementState = new HumanMovementState()
 movement state
 
float m_fDelay
 runtime config
 
float m_fDamping
 
float m_fDelayTimer
 runtime values
 
float m_fJumpStartY
 
float m_fJumpOffset
 
float m_jumpOffsetVelocity [1]
 
int m_iPelvisBone
 
float m_fTime
 
class DayZPlayerCamera3rdPersonErcRaisedMelee extends DayZPlayerCamera3rdPersonErcRaised CONST_CAMERAMOVEMENTHEIGH = 0.4
 
float m_fCameraHeight
 
float m_fCameraHeightVel [1]
 
class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelX [1]
 
class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelY [1]
 
class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelZ [1]
 
float m_LookAtLRAngle
 

Function Documentation

◆ DayZPlayerCamera3rdPerson()

void DayZPlayerCamera3rdPersonErc::DayZPlayerCamera3rdPerson ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 159 of file DayZPlayerCamera3rdPerson.c.

169{
171 {
void DayZPlayerCamera3rdPersonJump(DayZPlayer pPlayer, HumanInputController pInput)

Referenced by Hologram::GetProjectionEntityPosition().

◆ DayZPlayerCamera3rdPersonClimb()

Definition at line 168 of file DayZPlayerCamera3rdPerson.c.

222 {
223 //Print("new camera: DayZPlayerCamera3rdPersonClimb");
224 m_fDistance = 1.0;
225 m_CameraOffsetMS = "0.0 0.3 -0.6";
226 m_iBoneIndex = pPlayer.GetBoneIndexByName("Spine");
228 }
vector m_CameraOffsetMS
model space offset
int m_iBoneIndex
runtime config
float m_fDistance
distance from start
float m_fPredictCollisionRadius
collision prediction

Referenced by DayZPlayerCameras::RegisterCameras().

◆ DayZPlayerCamera3rdPersonCrouch()

void DayZPlayerCamera3rdPersonCrouch ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 352 of file DayZPlayerCamera3rdPerson.c.

353 {
354 //Print("new camera: DayZPlayerCamera3rdPersonCrouch");
355
356 m_fDistance = 1.4;
357 m_CameraOffsetMS = "0.0 0.7 0.1";
358 m_CameraOffsetLS = "0.0 0.3 0.0";
359 m_fShoulderWidth = 0.3;
360 }
float m_fShoulderWidth
shoulder camera widths
vector m_CameraOffsetLS
local space offset

References m_CameraOffsetLS, m_CameraOffsetMS, m_fDistance, and m_fShoulderWidth.

◆ DayZPlayerCamera3rdPersonErc()

Definition at line 4 of file DayZPlayerCamera3rdPerson.c.

153 {
154 //Print("new camera: DayZPlayerCamera3rdPersonErc");
155
156 m_fDistance = 1.6;
157 m_CameraOffsetMS = "0.0 1.4 0.0";
158 m_CameraOffsetLS = "0.0 0.3 0.0";
159 m_fShoulderWidth = 0.3;
161 }

References CONST_LR_MAX, CONST_LR_MIN, CONST_UD_MAX, and CONST_UD_MIN.

◆ DayZPlayerCamera3rdPersonErcRaised()

Definition at line 234 of file DayZPlayerCamera3rdPerson.c.

286 {
287 //Print("new camera: DayZPlayerCamera3rdPersonErcRaised");
289
290 if (pPlayer.GetCurrentPerItemCameraUD() == DayZPlayerCameras.PERITEMUD_EMPTYHANDED)
291 {
292 // no item in hands
293 m_fDistance = 1.2;
294 m_fShoulderWidth = 0.4;
295 m_CameraOffsetMS = "0.0 1.3 0.2";
296 m_CameraOffsetLS = "0.0 0.3 0.0";
297
298 }
299 else if (pPlayer.GetCurrentPerItemCameraUD() == DayZPlayerCameras.PERITEMUD_TWOHANDED)
300 {
301 // two handed
302 m_fDistance = 1.2;
303 m_fShoulderWidth = 0.4;
304 m_CameraOffsetMS = "0.0 1.3 0.2";
305 m_CameraOffsetLS = "0.0 0.3 0.0";
306 }
307 else if (pPlayer.GetCurrentPerItemCameraUD() == DayZPlayerCameras.PERITEMUD_ONEHANDED)
308 {
309 // one handed
310 m_fDistance = 1.2;
311 m_fShoulderWidth = 0.4;
312 m_CameraOffsetMS = "0.0 1.3 0.2";
313 m_CameraOffsetLS = "0.0 0.3 0.0";
314 }
315 else
316 {
317 // weapons in hands
318 m_fDistance = 0.8;
319 m_CameraOffsetMS = "0.0 1.3 0.2";
320 m_CameraOffsetLS = "0.0 0.3 0.0";
321 m_fShoulderWidth = 0.5;
322 }
323 }
static const int PERITEMUD_TWOHANDED
for empty hands
static const int PERITEMUD_EMPTYHANDED
uninitialized / invalid per item camera user data
static const int PERITEMUD_ONEHANDED
for empty hands

◆ DayZPlayerCamera3rdPersonErcSpr()

void DayZPlayerCamera3rdPersonErcRaised::DayZPlayerCamera3rdPersonErcSpr ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 286 of file DayZPlayerCamera3rdPerson.c.

286 {
287 //Print("new camera: DayZPlayerCamera3rdPersonErcRaised");
289
290 if (pPlayer.GetCurrentPerItemCameraUD() == DayZPlayerCameras.PERITEMUD_EMPTYHANDED)
291 {
292 // no item in hands
293 m_fDistance = 1.2;
294 m_fShoulderWidth = 0.4;
295 m_CameraOffsetMS = "0.0 1.3 0.2";
296 m_CameraOffsetLS = "0.0 0.3 0.0";
297
298 }
299 else if (pPlayer.GetCurrentPerItemCameraUD() == DayZPlayerCameras.PERITEMUD_TWOHANDED)
300 {

Referenced by DayZPlayerCameras::RegisterCameras().

◆ DayZPlayerCamera3rdPersonJump()

void DayZPlayerCamera3rdPersonClimb::DayZPlayerCamera3rdPersonJump ( DayZPlayer pPlayer,
HumanInputController pInput )

runtime config

runtime values

Definition at line 222 of file DayZPlayerCamera3rdPerson.c.

222 {
223 //Print("new camera: DayZPlayerCamera3rdPersonClimb");
224 m_fDistance = 1.0;
225 m_CameraOffsetMS = "0.0 0.3 -0.6";
226 m_iBoneIndex = pPlayer.GetBoneIndexByName("Spine");
228 }
229}
230
231// *************************************************************************************
232// ! DayZPlayerCamera3rdPersonErc - 3rd person erected sprint
233// *************************************************************************************
void DayZPlayerCamera3rdPersonErcSpr(DayZPlayer pPlayer, HumanInputController pInput)

References m_CameraOffsetMS, m_fDistance, m_fPredictCollisionRadius, and m_iBoneIndex.

Referenced by DayZPlayerCameras::RegisterCameras().

◆ DayZPlayerCamera3rdPersonProne()

void DayZPlayerCamera3rdPersonProneRaised::DayZPlayerCamera3rdPersonProne ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 527 of file DayZPlayerCamera3rdPerson.c.

527 {
528 //Print("new camera: DayZPlayerCamera3rdPersonProneRaised");
529 m_iBoneIndex = pPlayer.GetBoneIndexByName("Camera3rd_Helper");
530 m_fDistance = 1.0;
531 m_CameraOffsetMS = "0.0 0.4 0.0";
532 m_CameraOffsetLS = "0.0 0.2 0.0";
533 m_fShoulderWidth = 0.5;
534 }
535

References m_CameraOffsetLS, m_CameraOffsetMS, m_fDistance, m_fShoulderWidth, and m_iBoneIndex.

Referenced by DayZPlayerCameras::RegisterCameras().

◆ DayZPlayerCamera3rdPersonProneRaised()

class DayZPlayerCamera3rdPersonProne extends DayZPlayerCamera3rdPersonProneBase DayZPlayerCamera3rdPersonProneRaised ( DayZPlayer pPlayer,
HumanInputController pInput )
protected

Definition at line 507 of file DayZPlayerCamera3rdPerson.c.

527 {
528 //Print("new camera: DayZPlayerCamera3rdPersonProneRaised");
529 m_iBoneIndex = pPlayer.GetBoneIndexByName("Camera3rd_Helper");
530 m_fDistance = 1.0;
531 m_CameraOffsetMS = "0.0 0.4 0.0";
532 m_CameraOffsetLS = "0.0 0.2 0.0";
533 m_fShoulderWidth = 0.5;
534 }

Referenced by DayZPlayerCameras::RegisterCameras().

◆ GetAdditiveAngles()

override vector DayZPlayerCamera3rdPersonErc::GetAdditiveAngles ( )

Definition at line 251 of file DayZPlayerCamera3rdPerson.c.

255 {
256 m_fTime += pDt * 5;
257
258 vector tm[4];

◆ GetBaseAngles()

override vector DayZPlayerCamera3rdPersonErc::GetBaseAngles ( )

Definition at line 242 of file DayZPlayerCamera3rdPerson.c.

247 : hips bone not found");
248
249 m_fTime = 0.0;

◆ GetCameraName()

override string DayZPlayerCamera3rdPersonErc::GetCameraName ( )

Definition at line 260 of file DayZPlayerCamera3rdPerson.c.

◆ IsCamera3rdRaised()

override bool IsCamera3rdRaised ( )

Definition at line 325 of file DayZPlayerCamera3rdPerson.c.

326 {
327 return true;
328 }

◆ OnActivate()

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

Definition at line 175 of file DayZPlayerCamera3rdPerson.c.

186 {
187 super.OnUpdate(pDt, pOutResult);
188
189 float yPos = m_pPlayer.GetOrigin()[1];
DayZPlayer m_pPlayer
data
Definition dayzplayer.c:135

◆ OnUpdate()

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

update angles from input

base bone pos

apply shoulder dist

store distance

basically -> transform up vector (0,1,0) and read x coord -> and set is as roll

prev update

movement height

prev update

update angles from input

this is actually negative to yaw

base bone pos

apply shoulder dist

store distance

Definition at line 192 of file DayZPlayerCamera3rdPerson.c.

194 {
197 }
198 else
200
201 float newY = pOutResult.m_CameraTM[3][1] - m_fJumpOffset;
202 pOutResult.m_CameraTM[3][1] = newY;
203 }
204
206 float m_fDelay;
207 float m_fDamping;
208
210 float m_fDelayTimer;
211 float m_fJumpStartY;
212 float m_fJumpOffset;
213 float m_jumpOffsetVelocity[1];
214}
215
216// *************************************************************************************
217// ! DayZPlayerCamera3rdPersonJump - 3rd person jump
218// *************************************************************************************
220{
222 {
223 //Print("new camera: DayZPlayerCamera3rdPersonClimb");
224 m_fDistance = 1.0;
225 m_CameraOffsetMS = "0.0 0.3 -0.6";
226 m_iBoneIndex = pPlayer.GetBoneIndexByName("Spine");
228 }
229}
230
231// *************************************************************************************
232// ! DayZPlayerCamera3rdPersonErc - 3rd person erected sprint
233// *************************************************************************************
235{
237 {
238 //Print("new camera: DayZPlayerCamera3rdPersonErcSpr");
239
240 m_fDistance = 2.0;
int m_iBoneIndex
main bone
float m_jumpOffsetVelocity[1]
class DayZPlayerCamera3rdPersonJump extends DayZPlayerCamera3rdPersonErc DayZPlayerCamera3rdPersonClimb(DayZPlayer pPlayer, HumanInputController pInput)
float m_fDelay
runtime config
float m_fDelayTimer
runtime values
float m_fJumpStartY
float m_fJumpOffset
void DayZPlayerCamera3rdPersonErcSpr(DayZPlayer pPlayer, HumanInputController pInput)
Definition EnMath.c:7
float m_fDistance
camera distance (external cameras only)
Definition dayzplayer.c:63
float m_fPredictCollisionRadius
sphere radius used for collision prediction
Definition dayzplayer.c:65
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 m_fDelayTimer, and m_fJumpOffset.

◆ UpdateLRAngleLookAt()

float UpdateLRAngleLookAt ( float pMin,
float pMax,
float pDt )
protected

lr angle

Definition at line 413 of file DayZPlayerCamera3rdPerson.c.

414 {
417 {
420
421 m_fLRAngleVel[0] = 0; // reset filter
422 }
423 else
424 {
425 // smooth value back to 0
427 // m_fLeftRightAngle = 0.9 * (1.0 - pDt);
428 }
429
430 return m_LookAtLRAngle;
431 }
float m_LookAtLRAngle
float Limit(float pV, float pMin, float pMax)
limit function
bool m_bForceFreeLook
float m_fLRAngleVel[1]
proto native bool CameraIsFreeLook()
returns true if freelook is active
proto native vector GetAimChange()
returns per tick aim change (in radians)
HumanInputController m_pInput
human input
Definition dayzplayer.c:136
static const float RAD2DEG
Definition EnMath.c:16

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

Variable Documentation

◆ CONST_CAMERAMOVEMENTHEIGH

◆ CONST_LR_MAX

const float CONST_LR_MAX = 160.0
static

up limit

Definition at line 157 of file DayZPlayerCamera3rdPerson.c.

◆ CONST_LR_MIN

const float CONST_LR_MIN = -160.0
static

down limit

Definition at line 156 of file DayZPlayerCamera3rdPerson.c.

◆ CONST_UD_MAX

const float CONST_UD_MAX = 85.0
static

up limit

Definition at line 154 of file DayZPlayerCamera3rdPerson.c.

◆ CONST_UD_MIN

const float CONST_UD_MIN = -85.0
static

down limit

Definition at line 153 of file DayZPlayerCamera3rdPerson.c.

◆ m_BaseOffsetVelX

class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelX[1]
protected

◆ m_BaseOffsetVelY

class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelY[1]
protected

◆ m_BaseOffsetVelZ

class DayZPlayerCamera3rdPersonCrouchRaised extends DayZPlayerCamera3rdPersonCrouch m_BaseOffsetVelZ[1]
protected

◆ m_bShoulderInLS

bool m_bShoulderInLS
protected

true - shoulder is in local space

Definition at line 271 of file DayZPlayerCamera3rdPerson.c.

Referenced by DayZPlayerCameraBase::OnUpdate().

◆ m_CameraOffsetLS

◆ m_CameraOffsetMS

◆ m_fCameraHeight

float m_fCameraHeight
protected

Definition at line 377 of file DayZPlayerCamera3rdPerson.c.

◆ m_fCameraHeightVel

float m_fCameraHeightVel[1]
protected

Definition at line 378 of file DayZPlayerCamera3rdPerson.c.

◆ m_fCameraLRShoulder

float m_fCameraLRShoulder
protected

◆ m_fCameraLRShoulderVel

float m_fCameraLRShoulderVel[1]
protected

◆ m_fDamping

float m_fDamping

Definition at line 259 of file DayZPlayerCamera3rdPerson.c.

◆ m_fDelay

float m_fDelay

runtime config

Definition at line 258 of file DayZPlayerCamera3rdPerson.c.

◆ m_fDelayTimer

float m_fDelayTimer

runtime values

Definition at line 262 of file DayZPlayerCamera3rdPerson.c.

Referenced by OnUpdate().

◆ m_fDistance

float m_fDistance
protected

distance from start

Definition at line 269 of file DayZPlayerCamera3rdPerson.c.

Referenced by DayZPlayerCamera3rdPersonCrouch().

◆ m_fJumpOffset

float m_fJumpOffset

Definition at line 264 of file DayZPlayerCamera3rdPerson.c.

Referenced by OnUpdate().

◆ m_fJumpStartY

float m_fJumpStartY

Definition at line 263 of file DayZPlayerCamera3rdPerson.c.

◆ m_fLeanDistance

float m_fLeanDistance
protected

shift on leaning

Definition at line 273 of file DayZPlayerCamera3rdPerson.c.

Referenced by DayZPlayerCameraBase::DayZPlayerCamera3rdPerson().

◆ m_fLeftRightAngle

float m_fLeftRightAngle
protected

left right angle in rad (in freelook only)

Definition at line 279 of file DayZPlayerCamera3rdPerson.c.

◆ m_fLeftRightAngleAdd

float m_fLeftRightAngleAdd
protected

left right angle in rad (in freelook only)

Definition at line 280 of file DayZPlayerCamera3rdPerson.c.

◆ m_fPredictCollisionRadius

float m_fPredictCollisionRadius
protected

collision prediction

Definition at line 287 of file DayZPlayerCamera3rdPerson.c.

◆ m_fRoll

float m_fRoll
protected

camera roll (deprecated)

Definition at line 272 of file DayZPlayerCamera3rdPerson.c.

◆ m_fShoulderWidth

◆ m_fTime

float m_fTime
protected

Definition at line 325 of file DayZPlayerCamera3rdPerson.c.

Referenced by DayZPlayerCamera3rdPersonErc::OnUpdate().

◆ m_fUpDownAngle

float m_fUpDownAngle
protected

runtime values

up down angle in rad

Definition at line 277 of file DayZPlayerCamera3rdPerson.c.

◆ m_fUpDownAngleAdd

float m_fUpDownAngleAdd
protected

up down angle in rad

Definition at line 278 of file DayZPlayerCamera3rdPerson.c.

◆ m_iBoneIndex

int m_iBoneIndex = -1
protected

runtime config

main bone

Definition at line 266 of file DayZPlayerCamera3rdPerson.c.

◆ m_iPelvisBone

int m_iPelvisBone
protected

Definition at line 324 of file DayZPlayerCamera3rdPerson.c.

◆ m_jumpOffsetVelocity

float m_jumpOffsetVelocity[1]

Definition at line 265 of file DayZPlayerCamera3rdPerson.c.

◆ m_LookAtLRAngle

float m_LookAtLRAngle
protected

Definition at line 411 of file DayZPlayerCamera3rdPerson.c.

Referenced by UpdateLRAngleLookAt().

◆ m_MovementState