summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-28 21:51:26 +0200
committerworktycho <work.tycho@gmail.com>2015-05-28 21:51:26 +0200
commitb135ab8b956474f5538bef8b5fe9840419071716 (patch)
treef6e892e428f868fabd37231af76a37b1344a24b1 /src/Mobs/Monster.cpp
parentMerge pull request #2156 from SafwatHalaby/exit (diff)
parentAI - Sane Skeleton (diff)
downloadcuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.gz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.bz2
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.lz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.xz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.zst
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-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);