mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11754] Implement jump (parabolic movement) effect
Also correct destination calculation in Unit::KnockBackFrom - now spline knockback effect works similar to client's effect (same amplitude, speed etc)
This commit is contained in:
parent
28759f9ed4
commit
a7610f79c7
12 changed files with 58 additions and 25 deletions
|
|
@ -10496,10 +10496,9 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee
|
|||
float vsin = sin(angle);
|
||||
float vcos = cos(angle);
|
||||
|
||||
// Effect properly implemented only for players
|
||||
if(GetTypeId()==TYPEID_PLAYER)
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4);
|
||||
WorldPacket data(SMSG_MOVE_KNOCK_BACK, 9+4+4+4+4+4);
|
||||
data << GetPackGUID();
|
||||
data << uint32(0); // Sequence
|
||||
data << float(vcos); // x direction
|
||||
|
|
@ -10510,15 +10509,15 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee
|
|||
}
|
||||
else
|
||||
{
|
||||
float dis = horizontalSpeed;
|
||||
float moveTimeHalf = verticalSpeed / Movement::gravity;
|
||||
float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-verticalSpeed);
|
||||
|
||||
float dis = 2 * moveTimeHalf * horizontalSpeed;
|
||||
float ox, oy, oz;
|
||||
GetPosition(ox, oy, oz);
|
||||
|
||||
float fx = ox + dis * vcos;
|
||||
float fy = oy + dis * vsin;
|
||||
float fz = oz;
|
||||
|
||||
float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case
|
||||
if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx2,fy2,fz2, -0.5f))
|
||||
{
|
||||
|
|
@ -10526,12 +10525,8 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee
|
|||
fy = fy2;
|
||||
fz = fz2;
|
||||
}
|
||||
|
||||
UpdateAllowedPositionZ(fx, fy, fz);
|
||||
|
||||
//FIXME: this mostly hack, must exist some packet for proper creature move at client side
|
||||
// with CreatureRelocation at server side
|
||||
NearTeleportTo(fx, fy, fz, GetOrientation(), this == target);
|
||||
GetMotionMaster()->MoveJump(fx,fy,fz,horizontalSpeed,max_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue