Core/Entities: Some changes to LoS z checking & MotionMaster::MoveJumpTo (PR #20970)

- Use Midsection height for LoS checking.
- Changed MotionMaster::MoveJumpTo to use correct z. This change also makes sure the _owner will jump towards the given angle. Instead of jumping to a unintended angle if the first one is not in LoS.
This commit is contained in:
Golrag
2017-12-14 16:56:30 +01:00
committed by Treeston
parent 16739c6260
commit 95456ab5d8
8 changed files with 42 additions and 43 deletions
+9 -3
View File
@@ -1217,7 +1217,7 @@ bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare,
Position WorldObject::GetHitSpherePointFor(Position const& dest) const
{
G3D::Vector3 vThis(GetPositionX(), GetPositionY(), GetPositionZ());
G3D::Vector3 vThis(GetPositionX(), GetPositionY(), GetPositionZ() + GetMidsectionHeight());
G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(GetPosition()), GetCombatReach());
@@ -1230,11 +1230,14 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz, LineOfSightChecks ch
{
float x, y, z;
if (GetTypeId() == TYPEID_PLAYER)
{
GetPosition(x, y, z);
z += GetMidsectionHeight();
}
else
GetHitSpherePointFor({ ox, oy, oz }, x, y, z);
return GetMap()->isInLineOfSight(x, y, z + 2.0f, ox, oy, oz + 2.0f, GetPhaseMask(), checks, ignoreFlags);
return GetMap()->isInLineOfSight(x, y, z, ox, oy, oz, GetPhaseMask(), checks, ignoreFlags);
}
return true;
@@ -1247,9 +1250,12 @@ bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, LineOfSightChecks che
float x, y, z;
if (obj->GetTypeId() == TYPEID_PLAYER)
{
obj->GetPosition(x, y, z);
z += GetMidsectionHeight();
}
else
obj->GetHitSpherePointFor(GetPosition(), x, y, z);
obj->GetHitSpherePointFor({ GetPositionX(), GetPositionY(), GetPositionZ() + GetMidsectionHeight() }, x, y, z);
return IsWithinLOS(x, y, z, checks, ignoreFlags);
}