696 {
697 vector targetDirection = target.GetDirection();
700 {
701 targetDirection =
Vector(targetZombie.GetOrientationSynced(),0,0);
703 }
704 vector toSourceDirection = (source.GetPosition() - target.GetPosition());
705
706 targetDirection[1] = 0;
707 toSourceDirection[1] = 0;
708
711
712 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
713 vector cross = targetDirection * toSourceDirection;
714
716
717 if (cross[1] < 0)
718 hitDir = -hitDir;
719
720 return hitDir <= (-180 + angle) || hitDir >= (180 - angle);
721 }
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