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

◆ IsEntityBehindEntityInAngle()

bool IsEntityBehindEntityInAngle ( EntityAI source,
EntityAI target,
float angle )
private

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

693 {
694 vector targetDirection = target.GetDirection();
695 ZombieBase targetZombie;
696 if (Class.CastTo(targetZombie, target))
697 {
698 targetDirection = Vector(targetZombie.GetOrientationSynced(),0,0);
699 targetDirection = targetDirection.AnglesToVector();
700 }
701 vector toSourceDirection = (source.GetPosition() - target.GetPosition());
702
703 targetDirection[1] = 0;
704 toSourceDirection[1] = 0;
705
706 targetDirection.Normalize();
707 toSourceDirection.Normalize();
708
709 float cosFi = vector.Dot(targetDirection, toSourceDirection);
710 vector cross = targetDirection * toSourceDirection;
711
712 int hitDir = Math.Acos(cosFi) * Math.RAD2DEG;
713
714 if (cross[1] < 0)
715 hitDir = -hitDir;
716
717 return hitDir <= (-180 + angle) || hitDir >= (180 - angle);
718 }
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnMath.c:7
Определения ZombieFemaleBase.c:2
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Определения EnConvert.c:271
proto float Normalize()
Normalizes vector. Returns length.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
Определения EnConvert.c:106
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static const float RAD2DEG
Определения EnMath.c:16

Перекрестные ссылки Math::Acos(), vector::AnglesToVector(), Class::CastTo(), vector::Dot(), vector::Normalize(), Math::RAD2DEG и Vector().

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