DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerImplementHeading Class Reference
Collaboration diagram for DayZPlayerImplementHeading:
[legend]

Static Private Member Functions

static bool ClampHeading (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 
static bool RotateOrient (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 
static bool NoHeading (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 

Static Private Attributes

static float CONST_ROTLIMIT = Math.PI * 0.95
 

Detailed Description

Definition at line 10 of file DayZPlayerImplementHeading.c.

Member Function Documentation

◆ ClampHeading()

static bool DayZPlayerImplementHeading::ClampHeading ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff )
inlinestaticprivate

This HeadingModel - Clamps heading

Definition at line 19 of file DayZPlayerImplementHeading.c.

20 {
21 float aDiff = pModel.m_fHeadingAngle - pModel.m_fOrientationAngle;
22 if (aDiff < -Math.PI)
23 aDiff += Math.PI2;
24 else if (aDiff > Math.PI)
25 aDiff -= Math.PI2;
26
27 // Print("Heading model: or: " + pModel.m_fOrientationAngle.ToString() + " head:" + pModel.m_fHeadingAngle.ToString() + " dif:" + aDiff.ToString());
28
30 {
31 aDiff = -Math.PI + 0.01;
33 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle + aDiff;
34
35 // Print("-APA- : or: " + pModel.m_fOrientationAngle.ToString() + " head:" + pModel.m_fHeadingAngle.ToString() + " dif:" + aDiff.ToString());
36
37 return true; // modify heading
38 }
39 else if (pLastHeadingDiff > Math.PI_HALF && aDiff < 0)
40 {
41 aDiff = Math.PI - 0.01;
43 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle + aDiff;
44
45 // Print("-APA- : or: " + pModel.m_fOrientationAngle.ToString() + " head:" + pModel.m_fHeadingAngle.ToString() + " dif:" + aDiff.ToString());
46
47 return true; // modify heading
48 }
49
51 // Print("Heading model diff " + aDiff.ToString());
52 return false;
53 }
Definition EnMath.c:7
static const float PI2
Definition EnMath.c:13
static const float PI_HALF
Definition EnMath.c:14
static const float PI
Definition EnMath.c:12

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

Referenced by DayZPlayer::HeadingModel(), and ManBase::HeadingModel().

◆ NoHeading()

static bool DayZPlayerImplementHeading::NoHeading ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff )
inlinestaticprivate

Definition at line 110 of file DayZPlayerImplementHeading.c.

111 {
113 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle;
114 return true;
115 }

Referenced by DayZPlayer::HeadingModel(), and ManBase::HeadingModel().

◆ RotateOrient()

static bool DayZPlayerImplementHeading::RotateOrient ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff )
inlinestaticprivate

Definition at line 63 of file DayZPlayerImplementHeading.c.

64 {
65 float aDiff = pModel.m_fHeadingAngle - pModel.m_fOrientationAngle;
66
67 while (aDiff < -Math.PI)
68 aDiff += Math.PI2;
69 while (aDiff > Math.PI)
70 aDiff -= Math.PI2;
71
72 // Print("Heading model: or: " + pModel.m_fOrientationAngle.ToString() + " head:" + pModel.m_fHeadingAngle.ToString() + " dif:" + aDiff.ToString());
73
75 aDiff -= Math.PI2;
76 else if (pLastHeadingDiff > Math.PI_HALF && aDiff < 0)
77 aDiff += Math.PI2;
78
80 if (aDiff < -CONST_ROTLIMIT)
81 {
82 // character is somehow stucked (happens in prone stance)
84 {
86 return false;
87 }
88
89 pModel.m_fOrientationAngle += aDiff + CONST_ROTLIMIT;
90 return true;
91 }
92 else if (aDiff > CONST_ROTLIMIT)
93 {
94 // character is somehow stucked (happens in prone stance)
96 {
98 return false;
99 }
100
101 pModel.m_fOrientationAngle += aDiff - CONST_ROTLIMIT;
102 return true;
103 }
104
105 // Print("Heading model diff " + aDiff.ToString());
106 return false;
107
108 }

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

Referenced by DayZPlayer::HeadingModel().

Member Data Documentation

◆ CONST_ROTLIMIT

float DayZPlayerImplementHeading::CONST_ROTLIMIT = Math.PI * 0.95
staticprivate

This HeadingModel - Rotates orientations - so player slides

Definition at line 60 of file DayZPlayerImplementHeading.c.

Referenced by RotateOrient().


The documentation for this class was generated from the following file: