diff options
author | worktycho <work.tycho@gmail.com> | 2015-05-28 21:51:26 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-05-28 21:51:26 +0200 |
commit | b135ab8b956474f5538bef8b5fe9840419071716 (patch) | |
tree | f6e892e428f868fabd37231af76a37b1344a24b1 /src/Mobs/Monster.cpp | |
parent | Merge pull request #2156 from SafwatHalaby/exit (diff) | |
parent | AI - Sane Skeleton (diff) | |
download | cuberite-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.cpp | 11 |
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); |