DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DayZPlayerCameraVehicles.c

См. исходные тексты.

Структуры данных

class  DayZPlayerCamera1stPerson
 

Функции

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

Переменные

class DayZPlayerCamera1stPersonVehicle extends DayZPlayerCamera1stPerson CONST_UD_MIN = -85.0
 down limit
 
static const float CONST_UD_MAX = 85.0
 up limit
 
const float UP_ANGLE_CAP = 10
 
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 = 10.0
 
const float CONST_ANGULAR_LAG_PITCH_STRENGTH = 50.0
 
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
 

Функции

◆ DayZPlayerCamera3rdPersonVehicle()

void DayZPlayerCamera3rdPersonVehicle ( DayZPlayer pPlayer,
HumanInputController pInput )
35 {
36 //Print("new camera: DayZPlayerCamera3rdPersonVehicle");
37
38 m_fDistance = 4.0;
39 m_CameraOffsetMS = "0.0 1.3 0.0";
40
41 HumanCommandVehicle vehicleCommand = pPlayer.GetCommand_Vehicle();
42 if ( vehicleCommand )
43 {
44 Transport transport = vehicleCommand.GetTransport();
45 if ( transport )
46 {
48 m_fDistance = transport.GetTransportCameraDistance();
49 m_CameraOffsetMS = transport.GetTransportCameraOffset();
50 }
51 }
52 }
vector m_CameraOffsetMS
runtime config
Definition DayZPlayerCameraVehicles.c:177
float m_fDistance
distance from start
Definition DayZPlayerCameraVehicles.c:178
Transport m_Transport
cache
Definition DayZPlayerCameraVehicles.c:197
Definition human.c:690
Definition EntityAI.c:95
Base native class for all motorized wheeled vehicles.
Definition Boat.c:28

Перекрестные ссылки m_CameraOffsetMS, m_fDistance и m_Transport.

Используется в DayZPlayerCameras::RegisterCameras().

◆ GetAdditiveAngles()

override vector GetAdditiveAngles ( )
168 {
169 vector a;
170 a[0] = m_fUpDownAngleAdd;
172 a[2] = 0;
173 return a;
174 }
float m_fLeftRightAngleAdd
left right angle in rad
Definition DayZPlayerCameraVehicles.c:184
float m_fUpDownAngleAdd
up down angle in rad
Definition DayZPlayerCameraVehicles.c:182
Definition EnConvert.c:106

Перекрестные ссылки DayZPlayerCameraBase::m_fLeftRightAngleAdd и DayZPlayerCameraBase::m_fUpDownAngleAdd.

◆ GetBaseAngles()

override vector GetBaseAngles ( )
159 {
160 vector a;
161 a[0] = m_fUpDownAngle;
162 a[1] = m_fLeftRightAngle;
163 a[2] = 0;
164 return a;
165 }
float m_fLeftRightAngle
left right angle in rad
Definition DayZPlayerCameraVehicles.c:183
float m_fUpDownAngle
runtime values
Definition DayZPlayerCameraVehicles.c:181

Перекрестные ссылки DayZPlayerCameraBase::m_fLeftRightAngle и DayZPlayerCameraBase::m_fUpDownAngle.

◆ OnActivate()

override void OnActivate ( DayZPlayerCamera pPrevCamera,
DayZPlayerCameraResult pPrevCameraResult )
55 {
56 if (pPrevCamera)
57 {
58 vector baseAngles = pPrevCamera.GetBaseAngles();
61
62 vector addAngles = pPrevCamera.GetAdditiveAngles();
65 }
66
71 }
vector m_LagOffsetPosition
lag offsets
Definition DayZPlayerCameraVehicles.c:187
float m_fLagOffsetVelocityY[1]
Definition DayZPlayerCameraVehicles.c:190
float m_fLagOffsetVelocityX[1]
Definition DayZPlayerCameraVehicles.c:189
float m_fLagOffsetVelocityZ[1]
Definition DayZPlayerCameraVehicles.c:191
static const vector Zero
Definition EnConvert.c:110

Перекрестные ссылки m_fLagOffsetVelocityX, m_fLagOffsetVelocityY, m_fLagOffsetVelocityZ, m_fLeftRightAngle, m_fLeftRightAngleAdd, m_fUpDownAngle, m_fUpDownAngleAdd, m_LagOffsetPosition и vector::Zero.

◆ 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

74 {
77 m_pPlayer.GetTransform(playerTransformWS);
78
81 pOutResult.m_CollisionIgnoreEntity = vehicle;
82
85 if ( vehicle )
86 {
87 vector vehiclePositionWS = vehicle.GetOrigin();
90 }
91
96
101
102 if (vehicle)
103 {
105 posDiffLS = posDiffWS.InvMultiply3(playerTransformWS);
106
108 rotDiffLS = rotDiffWS.InvMultiply3(playerTransformWS);
109
110 orientVeh = m_Transport.GetOrientation() * Math.DEG2RAD;
111 }
112
117
121
123 vector rot;
127
128 float distance = m_fDistance;
129
130 if (m_CurrentCameraPitch > UP_ANGLE_CAP) // restrict moving camera below surface level
131 {
135
137
138 }
139 else
141
144
146 pOutResult.m_fDistance = distance;
147 pOutResult.m_fUseHeading = 0.0;
148 pOutResult.m_fInsideCamera = 0.0;
149 pOutResult.m_fIgnoreParentRoll = 1.0;
150 pOutResult.m_fIgnoreParentPitch = 1.0;
151 pOutResult.m_bUpdateEveryFrame = GetGame().IsPhysicsExtrapolationEnabled();
152
154
155 super.OnUpdate(pDt, pOutResult);
156 }
float UpdateLRAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
Definition DayZPlayerCamera_Base.c:190
float m_CurrentCameraYaw
Definition DayZPlayerCamera_Base.c:578
float m_CurrentCameraPitch
Definition DayZPlayerCamera_Base.c:579
float UpdateUDAngleUnlocked(out float pAngle, out float pAngleAdd, float pMin, float pMax, float pDt)
Definition DayZPlayerCamera_Base.c:129
void StdFovUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
Definition DayZPlayerCamera_Base.c:315
float m_CurrentCameraRoll
Definition DayZPlayerCamera_Base.c:580
vector m_LagOffsetOrientation
Definition DayZPlayerCameraVehicles.c:188
const float CONST_ANGULAR_LAG_ROLL_STRENGTH
Definition DayZPlayerCameraVehicles.c:32
const float CONST_ANGULAR_VELOCITY_STRENGTH
Definition DayZPlayerCameraVehicles.c:28
float m_fLagOffsetVelocityYaw[1]
Definition DayZPlayerCameraVehicles.c:192
const float UP_ANGLE_CAP
Definition DayZPlayerCameraVehicles.c:22
static const float CONST_UD_MAX
up limit
Definition DayZPlayerCameraVehicles.c:21
const float CONST_ANGULAR_LAG_PITCH_STRENGTH
Definition DayZPlayerCameraVehicles.c:31
static const float CONST_LR_MIN
down limit
Definition DayZPlayerCameraVehicles.c:24
static const float CONST_LR_MAX
up limit
Definition DayZPlayerCameraVehicles.c:25
float m_fLagOffsetVelocityPitch[1]
Definition DayZPlayerCameraVehicles.c:193
class DayZPlayerCamera1stPersonVehicle extends DayZPlayerCamera1stPerson CONST_UD_MIN
down limit
float m_fLagOffsetVelocityRoll[1]
Definition DayZPlayerCameraVehicles.c:194
const float CONST_ANGULAR_LAG_YAW_STRENGTH
Definition DayZPlayerCameraVehicles.c:30
const float CONST_LINEAR_VELOCITY_STRENGTH
Definition DayZPlayerCameraVehicles.c:27
Definition EnEntity.c:165
Definition EnMath3D.c:28
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 float SmoothCDPI2PI(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Definition EnMath.c:680
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
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.
static const float RAD2DEG
Definition EnMath.c:16
static const float DEG2RAD
Definition EnMath.c:17
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto vector dBodyGetAngularVelocity(notnull IEntity body)
Gets angular velocity for a rigidbody.

Перекрестные ссылки 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(), Math::DEG2RAD, GetCurrentOrientation(), GetGame(), GetVelocity(), Math::InverseLerp(), DayZPlayerCameraBase::m_CameraOffsetMS, m_CurrentCameraPitch, m_CurrentCameraRoll, m_CurrentCameraYaw, m_fDistance, 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(), Math::SmoothCDPI2PI(), StdFovUpdate(), UP_ANGLE_CAP, UpdateLRAngleUnlocked(), UpdateUDAngleUnlocked(), Math3D::YawPitchRollMatrix() и vector::Zero.

Переменные

◆ CONST_ANGULAR_LAG_PITCH_STRENGTH

const float CONST_ANGULAR_LAG_PITCH_STRENGTH = 50.0

Используется в OnUpdate().

◆ CONST_ANGULAR_LAG_ROLL_STRENGTH

const float CONST_ANGULAR_LAG_ROLL_STRENGTH = 0.0

Используется в OnUpdate().

◆ CONST_ANGULAR_LAG_YAW_STRENGTH

const float CONST_ANGULAR_LAG_YAW_STRENGTH = 10.0

Используется в OnUpdate().

◆ CONST_ANGULAR_VELOCITY_STRENGTH

const float CONST_ANGULAR_VELOCITY_STRENGTH = 0.025

Используется в OnUpdate().

◆ CONST_LINEAR_VELOCITY_STRENGTH

const float CONST_LINEAR_VELOCITY_STRENGTH = 0.025

Используется в OnUpdate().

◆ CONST_LR_MAX

const float CONST_LR_MAX = 160.0
static

up limit

Используется в DayZPlayerCameraBase::OnUpdate().

◆ CONST_LR_MIN

const float CONST_LR_MIN = -160.0
static

down limit

Используется в DayZPlayerCameraBase::OnUpdate().

◆ CONST_UD_MAX

const float CONST_UD_MAX = 85.0
static

up limit

Используется в DayZPlayerCameraBase::OnUpdate().

◆ CONST_UD_MIN

◆ m_CameraOffsetMS

vector m_CameraOffsetMS
protected

runtime config

model space offset

◆ m_fDistance

float m_fDistance
protected

distance from start

◆ m_fLagOffsetVelocityPitch

float m_fLagOffsetVelocityPitch[1]
protected

Используется в OnUpdate().

◆ m_fLagOffsetVelocityRoll

float m_fLagOffsetVelocityRoll[1]
protected

Используется в OnUpdate().

◆ m_fLagOffsetVelocityX

float m_fLagOffsetVelocityX[1]
protected

Используется в OnActivate() и OnUpdate().

◆ m_fLagOffsetVelocityY

float m_fLagOffsetVelocityY[1]
protected

Используется в OnActivate() и OnUpdate().

◆ m_fLagOffsetVelocityYaw

float m_fLagOffsetVelocityYaw[1]
protected

Используется в OnUpdate().

◆ m_fLagOffsetVelocityZ

float m_fLagOffsetVelocityZ[1]
protected

Используется в OnActivate() и 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

Используется в DayZPlayerCameraBase::GetBaseAngles(), DayZPlayerCameraBase::OnActivate() и DayZPlayerCameraBase::OnUpdate().

◆ m_fUpDownAngleAdd

float m_fUpDownAngleAdd
protected

◆ m_LagOffsetOrientation

vector m_LagOffsetOrientation
protected

Используется в OnUpdate().

◆ m_LagOffsetPosition

vector m_LagOffsetPosition
protected

lag offsets

Используется в OnActivate() и OnUpdate().

◆ m_Transport

Transport m_Transport
protected

cache

Используется в DayZPlayerCamera3rdPersonVehicle() и OnUpdate().

◆ UP_ANGLE_CAP

const float UP_ANGLE_CAP = 10

Используется в OnUpdate().