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

Go to the source code of this file.

Classes

class  DayZPlayerCamera1stPerson
 

Functions

void DayZPlayerCamera3rdPersonVehicle (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 ()
 

Variables

class DayZPlayerCamera1stPersonVehicle extends DayZPlayerCamera1stPerson 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
 
const float CONST_LINEAR_VELOCITY_STRENGTH = 0.025
 
const float CONST_ANGULAR_VELOCITY_STRENGTH = 0.025
 
const float CONST_ANGULAR_LAG_YAW_STRENGTH = 4.0
 
const float CONST_ANGULAR_LAG_PITCH_STRENGTH = 1.5
 
const float CONST_ANGULAR_LAG_ROLL_STRENGTH = 0.0
 
vector m_CameraOffsetMS
 runtime config
 
float m_fDistance
 distance from start
 
float m_fUpDownAngle
 runtime values
 
float m_fUpDownAngleAdd
 up down angle in rad
 
float m_fLeftRightAngle
 left right angle in rad
 
float m_fLeftRightAngleAdd
 left right angle in rad
 
vector m_LagOffsetPosition
 lag offsets
 
vector m_LagOffsetOrientation
 
float m_fLagOffsetVelocityX [1]
 
float m_fLagOffsetVelocityY [1]
 
float m_fLagOffsetVelocityZ [1]
 
float m_fLagOffsetVelocityYaw [1]
 
float m_fLagOffsetVelocityPitch [1]
 
float m_fLagOffsetVelocityRoll [1]
 
Transport m_Transport
 cache
 

Function Documentation

◆ DayZPlayerCamera3rdPersonVehicle()

void DayZPlayerCamera3rdPersonVehicle ( DayZPlayer pPlayer,
HumanInputController pInput )

Definition at line 33 of file DayZPlayerCameraVehicles.c.

34 {
35 //Print("new camera: DayZPlayerCamera3rdPersonVehicle");
36
37 m_fDistance = 4.0;
38 m_CameraOffsetMS = "0.0 1.3 0.0";
39
40 HumanCommandVehicle vehicleCommand = pPlayer.GetCommand_Vehicle();
42 {
43 Transport transport = vehicleCommand.GetTransport();
44 if (transport)
45 {
47 m_fDistance = transport.GetTransportCameraDistance();
48 m_CameraOffsetMS = transport.GetTransportCameraOffset();
49 }
50 }
51 }
vector m_CameraOffsetMS
runtime config
float m_fDistance
distance from start
Transport m_Transport
cache
Base native class for all motorized wheeled vehicles.
Definition Car.c:75

References m_CameraOffsetMS, m_fDistance, and m_Transport.

Referenced by DayZPlayerCameras::RegisterCameras().

◆ GetAdditiveAngles()

override vector GetAdditiveAngles ( )

Definition at line 150 of file DayZPlayerCameraVehicles.c.

151 {
152 vector a;
153 a[0] = m_fUpDownAngleAdd;
155 a[2] = 0;
156 return a;
157 }
float m_fLeftRightAngleAdd
left right angle in rad
float m_fUpDownAngleAdd
up down angle in rad

References DayZPlayerCameraBase::m_fLeftRightAngleAdd, and DayZPlayerCameraBase::m_fUpDownAngleAdd.

◆ GetBaseAngles()

override vector GetBaseAngles ( )

Definition at line 141 of file DayZPlayerCameraVehicles.c.

142 {
143 vector a;
144 a[0] = m_fUpDownAngle;
145 a[1] = m_fLeftRightAngle;
146 a[2] = 0;
147 return a;
148 }
float m_fLeftRightAngle
left right angle in rad
float m_fUpDownAngle
runtime values

References DayZPlayerCameraBase::m_fLeftRightAngle, and DayZPlayerCameraBase::m_fUpDownAngle.

◆ OnActivate()

override void OnActivate ( DayZPlayerCamera pPrevCamera,
DayZPlayerCameraResult pPrevCameraResult )

◆ OnUpdate()

override void OnUpdate ( float pDt,
out DayZPlayerCameraResult pOutResult )

get player transform

get vehicle and set it as ignore entity for camera collision solver

update camera offset

orientation LS

create LS lag from vehicle velocities

smooth it!

setup orientation

setup position

setup rest

Definition at line 72 of file DayZPlayerCameraVehicles.c.

73 {
76 m_pPlayer.GetTransform(playerTransformWS);
77
80 pOutResult.m_CollisionIgnoreEntity = vehicle;
81
84 if (vehicle)
85 {
86 vector vehiclePositionWS = vehicle.GetOrigin();
89 }
90
95
99
100 if (vehicle)
101 {
103 posDiffLS = posDiffWS.InvMultiply3(playerTransformWS);
104
106 rotDiffLS = rotDiffWS.InvMultiply3(playerTransformWS);
107 }
108
113
117
119 vector rot;
123
125
128
130 pOutResult.m_fDistance = m_fDistance;
131 pOutResult.m_fUseHeading = 0.0;
132 pOutResult.m_fInsideCamera = 0.0;
133 pOutResult.m_fIgnoreParentRoll = 1.0;
134 pOutResult.m_bUpdateEveryFrame = GetGame().IsPhysicsExtrapolationEnabled();
135
137
138 super.OnUpdate(pDt, pOutResult);
139 }
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)
float m_CurrentCameraRoll
vector m_LagOffsetOrientation
const float CONST_ANGULAR_LAG_ROLL_STRENGTH
const float CONST_ANGULAR_VELOCITY_STRENGTH
float m_fLagOffsetVelocityYaw[1]
static const float CONST_UD_MAX
up limit
const float CONST_ANGULAR_LAG_PITCH_STRENGTH
static const float CONST_LR_MIN
down limit
static const float CONST_LR_MAX
up limit
float m_fLagOffsetVelocityPitch[1]
class DayZPlayerCamera1stPersonVehicle extends DayZPlayerCamera1stPerson CONST_UD_MIN
down limit
float m_fLagOffsetVelocityRoll[1]
const float CONST_ANGULAR_LAG_YAW_STRENGTH
const float CONST_LINEAR_VELOCITY_STRENGTH
Definition EnMath.c:7
DayZPlayer m_pPlayer
data
Definition dayzplayer.c:135
vector GetCurrentOrientation()
Definition dayzplayer.c:112
proto native CGame GetGame()
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static const float RAD2DEG
Definition EnMath.c:16
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.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto vector dBodyGetAngularVelocity(notnull IEntity body)
Gets angular velocity for a rigidbody.

References CONST_ANGULAR_LAG_PITCH_STRENGTH, CONST_ANGULAR_LAG_ROLL_STRENGTH, CONST_ANGULAR_LAG_YAW_STRENGTH, CONST_ANGULAR_VELOCITY_STRENGTH, CONST_LINEAR_VELOCITY_STRENGTH, CONST_LR_MAX, CONST_LR_MIN, CONST_UD_MAX, CONST_UD_MIN, dBodyGetAngularVelocity(), GetCurrentOrientation(), GetGame(), GetVelocity(), DayZPlayerCameraBase::m_CameraOffsetMS, m_CurrentCameraPitch, m_CurrentCameraRoll, m_CurrentCameraYaw, DayZPlayerCameraBase::m_fDistance, m_fLagOffsetVelocityPitch, m_fLagOffsetVelocityRoll, m_fLagOffsetVelocityX, m_fLagOffsetVelocityY, m_fLagOffsetVelocityYaw, m_fLagOffsetVelocityZ, m_fLeftRightAngle, m_fLeftRightAngleAdd, m_fUpDownAngle, m_fUpDownAngleAdd, m_LagOffsetOrientation, m_LagOffsetPosition, m_pPlayer, m_Transport, Math::RAD2DEG, Math::SmoothCD(), StdFovUpdate(), UpdateLRAngleUnlocked(), UpdateUDAngleUnlocked(), Math3D::YawPitchRollMatrix(), and vector::Zero.

Variable Documentation

◆ CONST_ANGULAR_LAG_PITCH_STRENGTH

const float CONST_ANGULAR_LAG_PITCH_STRENGTH = 1.5

Definition at line 30 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ CONST_ANGULAR_LAG_ROLL_STRENGTH

const float CONST_ANGULAR_LAG_ROLL_STRENGTH = 0.0

Definition at line 31 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ CONST_ANGULAR_LAG_YAW_STRENGTH

const float CONST_ANGULAR_LAG_YAW_STRENGTH = 4.0

Definition at line 29 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ CONST_ANGULAR_VELOCITY_STRENGTH

const float CONST_ANGULAR_VELOCITY_STRENGTH = 0.025

Definition at line 27 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ CONST_LINEAR_VELOCITY_STRENGTH

const float CONST_LINEAR_VELOCITY_STRENGTH = 0.025

Definition at line 26 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ CONST_LR_MAX

const float CONST_LR_MAX = 160.0
static

up limit

Definition at line 24 of file DayZPlayerCameraVehicles.c.

Referenced by DayZPlayerCameraBase::OnUpdate().

◆ CONST_LR_MIN

const float CONST_LR_MIN = -160.0
static

down limit

Definition at line 23 of file DayZPlayerCameraVehicles.c.

Referenced by DayZPlayerCameraBase::OnUpdate().

◆ CONST_UD_MAX

const float CONST_UD_MAX = 85.0
static

up limit

Definition at line 21 of file DayZPlayerCameraVehicles.c.

Referenced by DayZPlayerCameraBase::OnUpdate().

◆ CONST_UD_MIN

◆ m_CameraOffsetMS

vector m_CameraOffsetMS
protected

runtime config

model space offset

Definition at line 160 of file DayZPlayerCameraVehicles.c.

◆ m_fDistance

float m_fDistance
protected

distance from start

Definition at line 161 of file DayZPlayerCameraVehicles.c.

◆ m_fLagOffsetVelocityPitch

float m_fLagOffsetVelocityPitch[1]
protected

Definition at line 176 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ m_fLagOffsetVelocityRoll

float m_fLagOffsetVelocityRoll[1]
protected

Definition at line 177 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ m_fLagOffsetVelocityX

float m_fLagOffsetVelocityX[1]
protected

Definition at line 172 of file DayZPlayerCameraVehicles.c.

Referenced by OnActivate(), and OnUpdate().

◆ m_fLagOffsetVelocityY

float m_fLagOffsetVelocityY[1]
protected

Definition at line 173 of file DayZPlayerCameraVehicles.c.

Referenced by OnActivate(), and OnUpdate().

◆ m_fLagOffsetVelocityYaw

float m_fLagOffsetVelocityYaw[1]
protected

Definition at line 175 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ m_fLagOffsetVelocityZ

float m_fLagOffsetVelocityZ[1]
protected

Definition at line 174 of file DayZPlayerCameraVehicles.c.

Referenced by OnActivate(), and OnUpdate().

◆ m_fLeftRightAngle

float m_fLeftRightAngle
protected

◆ m_fLeftRightAngleAdd

float m_fLeftRightAngleAdd
protected

◆ m_fUpDownAngle

float m_fUpDownAngle
protected

runtime values

up down angle in rad

Definition at line 164 of file DayZPlayerCameraVehicles.c.

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

◆ m_fUpDownAngleAdd

float m_fUpDownAngleAdd
protected

◆ m_LagOffsetOrientation

vector m_LagOffsetOrientation
protected

Definition at line 171 of file DayZPlayerCameraVehicles.c.

Referenced by OnUpdate().

◆ m_LagOffsetPosition

vector m_LagOffsetPosition
protected

lag offsets

Definition at line 170 of file DayZPlayerCameraVehicles.c.

Referenced by OnActivate(), and OnUpdate().

◆ m_Transport

Transport m_Transport
protected

cache

Definition at line 180 of file DayZPlayerCameraVehicles.c.

Referenced by DayZPlayerCamera3rdPersonVehicle(), and OnUpdate().