summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 3fbee9a65..c67850248 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -517,8 +517,15 @@ void cMonster::SetPitchAndYawFromDestination()
}
-
- Vector3d BodyDistance = m_NextWayPointPosition - GetPosition();
+ Vector3d BodyDistance;
+ if (!m_IsFollowingPath && (m_Target != nullptr))
+ {
+ BodyDistance = m_Target->GetPosition() - GetPosition();
+ }
+ else
+ {
+ BodyDistance = m_NextWayPointPosition - GetPosition();
+ }
double BodyRotation, BodyPitch;
BodyDistance.Normalize();
VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, BodyRotation, BodyPitch);