diff options
author | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-28 16:45:47 +0200 |
---|---|---|
committer | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-28 18:19:56 +0200 |
commit | f1540173da442878e132b0bbca1f8f60141e1cd0 (patch) | |
tree | 167748cd3f296946e245bc3809cf41153bd88c36 /src/Mobs/Monster.cpp | |
parent | Merge pull request #2152 from mc-server/fixes (diff) | |
download | cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.gz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.bz2 cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.lz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.xz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.zst cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.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); |