summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 16:45:47 +0200
committerSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 18:19:56 +0200
commitf1540173da442878e132b0bbca1f8f60141e1cd0 (patch)
tree167748cd3f296946e245bc3809cf41153bd88c36 /src/Mobs/Monster.cpp
parentMerge pull request #2152 from mc-server/fixes (diff)
downloadcuberite-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 '')
-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);