693 {
694 vector targetDirection = target.GetDirection();
697 {
698 targetDirection =
Vector(targetZombie.GetOrientationSynced(),0,0);
700 }
701 vector toSourceDirection = (source.GetPosition() - target.GetPosition());
702
703 targetDirection[1] = 0;
704 toSourceDirection[1] = 0;
705
708
709 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
710 vector cross = targetDirection * toSourceDirection;
711
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.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
proto float Normalize()
Normalizes vector. Returns length.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
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