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

Защищенные статические члены

static float ClampAngle (float angle, HeadingRestrictData restrictData)
 
static bool NoHeading (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 

Закрытые статические члены

static bool ClampHeading (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 
static bool RotateOrient (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
 
static bool RestrictHeading (float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff, HeadingRestrictData restrictData)
 

Закрытые статические данные

static float CONST_ROTLIMIT = Math.PI * 0.95
 

Подробное описание

Методы

◆ ClampAngle()

static float ClampAngle ( float angle,
HeadingRestrictData restrictData )
inlinestaticprotected
130 {
131 float testOtherDir;
132
133 if (restrictData.m_RestrictedR > restrictData.m_RestrictedL)
134 {
135 if (angle > restrictData.m_RestrictedL && angle < restrictData.m_RestrictedR)
136 {
137 //Print("STANDARD NOCLAMP: " + angle*Math.RAD2DEG + " |MIN: " + restrictData.m_RestrictedL*Math.RAD2DEG + " |MAX: " + restrictData.m_RestrictedR*Math.RAD2DEG);
138 return angle;
139 }
140 else
141 {
142 //Print("STANDARD CLAMP: " + angle*Math.RAD2DEG + " |MIN: " + restrictData.m_RestrictedL*Math.RAD2DEG + " |MAX: " + restrictData.m_RestrictedR*Math.RAD2DEG);
143
144 if (angle > restrictData.m_RestrictedR + 90 * Math.DEG2RAD) // check if restrictData.m_RestrictedR/restrictData.m_RestrictedL is close to -PI and the new angle flips to +PI or vice versa
145 return restrictData.m_RestrictedL;
146 else if (angle < restrictData.m_RestrictedL - 90 * Math.DEG2RAD)
147 return restrictData.m_RestrictedR;
148
149 return Math.Clamp(angle, restrictData.m_RestrictedL, restrictData.m_RestrictedR);
150 }
151 }
152 else if (restrictData.m_RestrictedR < restrictData.m_RestrictedL) // angle is restrited through 180 -> -180, clamping follows different rules
153 {
154 if ((angle >= -180 && angle < restrictData.m_RestrictedR) || (angle <= 180 && angle > restrictData.m_RestrictedL))
155 {
156 //Print("INVERSE NOCLAMP: " + angle*Math.RAD2DEG + " |MIN: " + restrictData.m_RestrictedL*Math.RAD2DEG + " |MAX: " + restrictData.m_RestrictedR*Math.RAD2DEG);
157 return angle;
158 }
159 else
160 {
161 //Print("INVERSE CLAMP: " + angle*Math.RAD2DEG + " |MIN: " + restrictData.m_RestrictedL*Math.RAD2DEG + " |MAX: " + restrictData.m_RestrictedR*Math.RAD2DEG);
162
163 if (angle < 0)
164 {
165 testOtherDir = Math.AbsFloat(restrictData.m_RestrictedR - angle);
166 if (testOtherDir < restrictData.m_AngleRangeInverted - testOtherDir)
167 return restrictData.m_RestrictedR;
168 else
169 return restrictData.m_RestrictedL;
170 }
171 else if (angle >= 0)
172 {
173 testOtherDir = Math.AbsFloat(restrictData.m_RestrictedL - angle);
174 if (testOtherDir < restrictData.m_AngleRangeInverted - testOtherDir)
175 return restrictData.m_RestrictedL;
176 else
177 return restrictData.m_RestrictedR;
178 }
179
180 return angle;
181 }
182 }
183
184 return angle;
185 }
Definition EnMath.c:7
Definition EntityAI.c:95
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float AbsFloat(float f)
Returns absolute value.
static const float DEG2RAD
Definition EnMath.c:17

Перекрестные ссылки Math::AbsFloat(), Math::Clamp() и Math::DEG2RAD.

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

◆ ClampHeading()

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

This HeadingModel - Clamps heading

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

Перекрестные ссылки Math::PI, Math::PI2 и Math::PI_HALF.

Используется в DayZPlayer::HeadingModel() и ManBase::HeadingModel().

◆ NoHeading()

static bool NoHeading ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff )
inlinestaticprotected
188 {
190 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle;
191 return true;
192 }

Используется в DayZPlayer::HeadingModel() и ManBase::HeadingModel().

◆ RestrictHeading()

static bool RestrictHeading ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff,
HeadingRestrictData restrictData )
inlinestaticprivate
123 {
124 pModel.m_fHeadingAngle = ClampAngle(pModel.m_fHeadingAngle, restrictData);
125 return true;
126 }
static float ClampAngle(float angle, HeadingRestrictData restrictData)
Definition DayZPlayerImplementHeading.c:129

Перекрестные ссылки ClampAngle().

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

◆ RotateOrient()

static bool RotateOrient ( float pDt,
SDayZPlayerHeadingModel pModel,
out float pLastHeadingDiff )
inlinestaticprivate
68 {
69 float aDiff = pModel.m_fHeadingAngle - pModel.m_fOrientationAngle;
70
71 while (aDiff < -Math.PI)
72 {
73 aDiff += Math.PI2;
74 }
75 while (aDiff > Math.PI)
76 {
77 aDiff -= Math.PI2;
78 }
79
80 // Print("Heading model: or: " + pModel.m_fOrientationAngle.ToString() + " head:" + pModel.m_fHeadingAngle.ToString() + " dif:" + aDiff.ToString());
81
83 {
84 aDiff -= Math.PI2;
85 }
86 else if (pLastHeadingDiff > Math.PI_HALF && aDiff < 0)
87 {
88 aDiff += Math.PI2;
89 }
90
92 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 else if (aDiff > CONST_ROTLIMIT)
105 {
106 // character is somehow stucked (happens in prone stance)
108 {
110 return false;
111 }
112
113 pModel.m_fOrientationAngle += aDiff - CONST_ROTLIMIT;
114 return true;
115 }
116
117 // Print("Heading model diff " + aDiff.ToString());
118 return false;
119
120 }
static float CONST_ROTLIMIT
Definition DayZPlayerImplementHeading.c:64

Перекрестные ссылки CONST_ROTLIMIT, Math::PI, Math::PI2 и Math::PI_HALF.

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

Поля

◆ CONST_ROTLIMIT

float CONST_ROTLIMIT = Math.PI * 0.95
staticprivate

This HeadingModel - Rotates orientations - so player slides

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


Объявления и описания членов класса находятся в файле: