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

◆ EvaluateComponentEx()

bool EvaluateComponentEx ( Object obj,
ComponentInfo cInfo,
MeleeTargetSettings settings,
out ComponentResult result,
array< string > blacklistedDamageZones )

check if the component is on blacklist, if so, continue in lookup

См. определение в файле MeleeTargeting.c строка 226

227 {
229 foreach (string zoneName: blacklistedDamageZones)
230 {
231 if (obj.GetDamageZoneNameByComponentIndex(cInfo.component) == zoneName)
232 {
233 return false;
234 }
235 }
236
237 vector componentPos = cInfo.componentCenter;
238
239 // Too far away! (fast reject)
240 float componentMaxDist2 = Math.SqrFloat(settings.MaxDist + cInfo.componentRadius * obj.GetScale());
241 vector nearestPoint = Math3D.NearestPoint(settings.RayStart, settings.RayEnd, componentPos);
242 float componentDistance2 = vector.DistanceSq(componentPos, nearestPoint);
243 if (componentDistance2 > componentMaxDist2)
244 {
245 return false;
246 }
247
248 // Here some more accurate check could be placed that would adjust the componentPos
249
250 // Outside of the cone angle!
251 float componentAngle = Math.RAD2DEG * Math.AbsFloat(Math3D.AngleFromPosition(settings.ConeOrigin, settings.XZDir, componentPos));
252 if (componentAngle > settings.ConeHalfAngle)
253 {
254 return false;
255 }
256
257 // Obstructed!
258 if (IsMeleeTargetObstructed(settings.RayStart, componentPos))
259 {
260 return false;
261 }
262
263 // We found something, fill it in!
264 result.ComponentPos = componentPos;
265 result.ComponentAngle = componentAngle;
266 result.ComponentDistance2 = componentDistance2;
267 result.ComponentIdx = cInfo.component;
268
269 return true;
270 }
bool IsMeleeTargetObstructed(vector rayStart, vector rayEnd)
Определения MeleeTargeting.c:277
Определения EnMath3D.c:28
Определения EnMath.c:7
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
static proto float AngleFromPosition(vector origin, vector originDir, vector target)
Angle that a target is from the direction of an origin.
static proto vector NearestPoint(vector beg, vector end, vector pos)
Point on line beg .. end nearest to pos.
static proto float SqrFloat(float f)
Returns squared value.
static const float RAD2DEG
Определения EnMath.c:16
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat(), Math3D::AngleFromPosition(), vector::DistanceSq(), IsMeleeTargetObstructed(), MeleeTargetSettings(), Math3D::NearestPoint(), Math::RAD2DEG и Math::SqrFloat().

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