Core/Movement: merged Collision height handling from 335 branch to reduce the probability that creatures are falling under the map

This commit is contained in:
Ovahlord
2019-02-17 23:40:24 +01:00
parent 3357ae7940
commit 50a91bd590
16 changed files with 134 additions and 138 deletions

View File

@@ -438,7 +438,9 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
float moveTimeHalf = speedZ / Movement::gravity;
float dist = 2 * moveTimeHalf * speedXY;
_owner->GetClosePoint(x, y, z, _owner->GetCombatReach(), dist, angle);
_owner->GetNearPoint2D(x, y, dist, _owner->GetOrientation() + angle);
z = _owner->GetPositionZ();
_owner->UpdateAllowedPositionZ(x, y, z);
MoveJump(x, y, z, 0.0f, speedXY, speedZ);
}
@@ -481,7 +483,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
if (_owner->IsFlying())
point.z = z;
else
point.z = _owner->GetMap()->GetHeight(_owner->GetPhaseShift(), point.x, point.y, z);
point.z = _owner->GetMapHeight(point.x, point.y, z);
init.Path().push_back(point);
}
@@ -567,11 +569,11 @@ void MotionMaster::ResumeSplineChain(SplineChainResumeInfo const& info)
void MotionMaster::MoveFall(uint32 id /*=0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseShift(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
float tz = _owner->GetMapHeight(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable to retrieve a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ() + _owner->GetPositionZ());
return;
}