mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Vehicle: Improved the position fix when changing vehicle from 5eb22e5b64
Thanks Shauren
This commit is contained in:
@@ -167,6 +167,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
||||
point_Idx_offset = args.path_Idx_offset;
|
||||
initialOrientation = args.initialOrientation;
|
||||
|
||||
onTransport = false;
|
||||
time_passed = 0;
|
||||
vertical_acceleration = 0.f;
|
||||
effect_start_time = 0;
|
||||
|
||||
@@ -119,6 +119,7 @@ namespace Movement
|
||||
const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3();}
|
||||
int32 currentPathIdx() const;
|
||||
|
||||
bool onTransport;
|
||||
std::string ToString() const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -71,10 +71,11 @@ namespace Movement
|
||||
real_position.z = unit.GetTransOffsetZ();
|
||||
real_position.orientation = unit.GetTransOffsetO();
|
||||
}
|
||||
|
||||
// there is a big chance that current position is unknown if current state is not finalized, need compute it
|
||||
// this also allows calculate spline position and update map position in much greater intervals
|
||||
// Don't compute for transport movement. The unit could be in a motion between two transports, thus having transport moveflag but is resulting in regular positions
|
||||
else if (!move_spline.Finalized())
|
||||
// Don't compute for transport movement if the unit is in a motion between two transports
|
||||
if (!move_spline.Finalized() && move_spline.onTransport == transport)
|
||||
real_position = move_spline.ComputePosition();
|
||||
|
||||
// should i do the things that user should do? - no.
|
||||
@@ -84,6 +85,7 @@ namespace Movement
|
||||
// corrent first vertex
|
||||
args.path[0] = real_position;
|
||||
args.initialOrientation = real_position.orientation;
|
||||
move_spline.onTransport = transport;
|
||||
|
||||
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
|
||||
if (args.flags.walkmode)
|
||||
|
||||
Reference in New Issue
Block a user