diff options
| author | Ovah <dreadkiller@gmx.de> | 2020-04-17 21:13:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-17 21:13:18 +0200 |
| commit | cfd63c350f5b01fd699903b17162b2f5167b1386 (patch) | |
| tree | 8e5c19eb06d9761b93bb1932f6916c8aeb0c7b2f /src | |
| parent | b69c5560dc3d8e8f2b957773d9d91bf5b6d21e89 (diff) | |
Core/Movement: various improvements for creature knockbacks
* creature knockbacks will no longer generate a full path but instead only use a destination point to reflect sniff data
* calculate the destination by using a mmap raycast instead of using a mmap path which had the chance of creating weird movements when GetNearPosition failed to get a proper collision point (knocking arround a tree for example or just somewhere it should not go at all)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index f8aebbc27ab..c5bca4f3883 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -737,15 +737,16 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa if (speedXY < 0.01f) return; - float x, y, z; + Position dest = _owner->GetPosition(); float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ); - _owner->GetNearPoint(_owner, x, y, z, dist, _owner->GetAbsoluteAngle(srcX, srcY) + float(M_PI)); + // Use a mmap raycast to get a valid destination. + _owner->MovePositionToFirstCollision(dest, dist, _owner->GetRelativeAngle(srcX, srcY) + float(M_PI)); Movement::MoveSplineInit init(_owner); - init.MoveTo(x, y, z); + init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false); init.SetParabolic(max_height, 0); init.SetOrientationFixed(true); init.SetVelocity(speedXY); |
