diff options
author | tycho <work.tycho@gmail.com> | 2015-05-29 01:12:56 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-05-29 01:12:56 +0200 |
commit | 4956e8700d9a578fc65481c0fcfddf812366f08b (patch) | |
tree | 47ae313c74a228d254b08c5a146bbd2ea10e08b7 /src/Mobs/Monster.cpp | |
parent | Fix comments (diff) | |
parent | Fixed Info.lua documentation (diff) | |
download | cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.gz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.bz2 cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.lz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.xz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.zst cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.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 44a037805..8d71c54e8 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); |