summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Mobs/Enderman.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 416b541ed..d26639a75 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -42,12 +42,14 @@ public:
return false;
}
- Direction.Normalize();
Vector3d LookVector = a_Player->GetLookVector();
- LookVector.Normalize();
+ double dot = Direction.Dot(LookVector);
- if ((Direction - LookVector).SqrLength() > 0.02)
+ // 0.09 rad ~ 5 degrees.
+ // If the players crosshars are 10 degrees from the line linking the endermen
+ // It counts as looking.
+ if (dot > cos(0.09))
{
return false;
}
@@ -140,4 +142,4 @@ void cEnderman::EventLosePlayer()
super::EventLosePlayer();
m_bIsScreaming = false;
GetWorld()->BroadcastEntityMetadata(*this);
-} \ No newline at end of file
+}