6 static const float CONST_UD_MAX = 85.0;
7 static const float CONST_UD_MIN_BACK = -25.0;
9 static const float CONST_LR_MIN = -160.0;
10 static const float CONST_LR_MAX = 160.0;
12 protected bool m_isEntering =
false;
13 protected bool m_opticsHasWeaponOverride =
false;
16 protected PPERequester_CameraADS m_RequesterADS;
19 float m_velocityYaw[1];
20 float m_velocityPitch[1];
21 float m_dynamicsStrength;
22 float m_dynamicsSmoothTime;
23 vector m_SightMisalignmentModifier;
25 float m_movementTimeAcc;
26 float m_movementAmplitudeX;
27 float m_movementAmplitudeY;
28 float m_movementFrequencyX;
29 float m_movementFrequencyY;
36 m_iBoneIndex = pPlayer.GetBoneIndexByName(
"RightHand_Dummy");
40 Print(
"DayZPlayerCamera1stPerson: main bone not found");
43 m_dynamicsStrength = 2;
44 m_dynamicsSmoothTime = 0.3;
51 m_movementTimeAcc = 0;
52 m_movementAmplitudeX = 1;
53 m_movementAmplitudeY = 1;
54 m_movementFrequencyX = 1;
55 m_movementFrequencyY = 2;
57 Class.CastTo(m_RequesterADS,PPERequester_CameraADS.Cast(PPERequesterBank.GetRequester(PPERequester_CameraADS)));
62 void SetupSightEntities()
70 m_SightMisalignmentModifier =
m_weaponUsed.GetPropertyModifierObject().m_SightMisalignment;
71 m_dynamicsStrength = m_dynamicsStrength * m_SightMisalignmentModifier[0];
72 m_dynamicsSmoothTime = m_dynamicsSmoothTime * m_SightMisalignmentModifier[1];
76 m_opticsHasWeaponOverride =
m_opticsUsed.HasWeaponIronsightsOverride();
89 super.OnActivate(pPrevCamera, pPrevCameraResult);
93 vector baseAngles = pPrevCamera.GetBaseAngles();
97 vector addAngles = pPrevCamera.GetAdditiveAngles();
105 if (m_opticsHasWeaponOverride)
123 m_opticsUsed.UseWeaponIronsightsOverride(m_opticsHasWeaponOverride);
142 min = CONST_UD_MIN_BACK;
157 float aimChangeX =
m_pInput.GetAimDelta(pDt)[0] *
Math.RAD2DEG;
158 float aimChangeY =
m_pInput.GetAimDelta(pDt)[1] *
Math.RAD2DEG;
163 float speed = hcm.GetCurrentMovementSpeed();
166 m_movementTimeAcc += pDt;
168 m_movementTimeAcc = 0;
170 aimChangeX += m_movementAmplitudeX * speed *
Math.Sin(
Math.PI2 * m_movementFrequencyX * m_movementTimeAcc);
171 aimChangeY += m_movementAmplitudeY * speed *
Math.Sin(
Math.PI2 * m_movementFrequencyY * m_movementTimeAcc);
174 aimChangeYPR[0] =
Math.SmoothCD(aimChangeYPR[0], -(m_dynamicsStrength * aimChangeY), m_velocityYaw, m_dynamicsSmoothTime, 1000, pDt);
175 aimChangeYPR[1] =
Math.SmoothCD(aimChangeYPR[1], -(m_dynamicsStrength * aimChangeX), m_velocityPitch, m_dynamicsSmoothTime, 1000, pDt);
179 Math3D.YawPitchRollMatrix(aimChangeYPR, dynamics);
180 dynamics[3] =
vector.Zero;
184 hia.WeaponGetAimingModelDirTm(aimingMatTM);
187 Math3D.MatrixMultiply4(dynamics, aimingMatTM, dynamics);
188 Math3D.MatrixMultiply4(dynamics, matTM, pOutResult.m_CameraTM);
223 pOutResult.m_iDirectBoneMode = 4;
227 pOutResult.m_bUpdateWhenBlendOut =
false;
228 pOutResult.m_fDistance = 0;
229 pOutResult.m_fUseHeading = 0;
230 pOutResult.m_fInsideCamera = 1.0;
233 pOutResult.m_fNearPlane = 0.04;
242 else if (m_isEntering)
245 m_isEntering =
false;
268 m_RequesterADS.Stop();
281 temp_array = {
false, 0.0, 0.0, 0.0, 0.0, 1.0};
293 if (temp_array.Count() != 6)
294 temp_array = {
false, 0.0, 0.0, 0.0, 0.0, 1.0};
297 m_RequesterADS.SetValuesIronsights(temp_array);
317 return "DayZPlayerCameraIronsights";
322 if (pPrevCamera.GetCameraName() ==
"DayZPlayerCamera1stPerson")
327 else if (pPrevCamera.GetCameraName() ==
"DayZPlayerCameraOptics")
338 void UpdateBatteryOptics(
EntityAI entity)
342 optics.UpdateOpticsReddotVisibility();
350 protected vector m_OpticsCamPos;
351 protected vector m_OpticsCamDir;
402 super.OnActivate(pPrevCamera,pPrevCameraResult);
414 pOutResult.m_iDirectBoneMode = 4;
418 pOutResult.m_bUpdateWhenBlendOut =
false;
419 pOutResult.m_fDistance = 0;
420 pOutResult.m_fUseHeading = 0;
421 pOutResult.m_fInsideCamera = 1.0;
444 else if (m_isEntering)
447 m_isEntering =
false;
474 m_RequesterADS.Stop();
495 temp_array = {
false, 0.0, 0.0, 0.0, 0.0, 1.0};
511 if (temp_array.Count() != 6)
512 temp_array = {
false, 0.0, 0.0, 0.0, 0.0, 1.0};
515 m_RequesterADS.SetValuesIronsights(temp_array);
555 m_RequesterADS.SetValuesOptics(mask_values,lens_values,gauss);
578 return "DayZPlayerCameraOptics";
583 if (pPrevCamera.GetCameraName() ==
"DayZPlayerCameraIronsights")
587 else if (pPrevCamera.GetCameraName() ==
"DayZPlayerCamera1stPerson")
591 else if (!pPrevCamera.IsCamera3rdRaised())