feat(Core/Movement): port smooth waypoint movement from Cataclysm Preservation Project (#25106)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com> Co-authored-by: Ovahlord <dreadkiller@gmx.de> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Kitzunu <Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -122,6 +122,7 @@ namespace Movement
|
||||
[[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); }
|
||||
[[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3(); }
|
||||
[[nodiscard]] int32 currentPathIdx() const;
|
||||
[[nodiscard]] int32 MaxPathIdx() const { return spline.last() - 1; }
|
||||
|
||||
[[nodiscard]] bool HasAnimation() const { return splineflags.animation; }
|
||||
[[nodiscard]] uint8 GetAnimationType() const { return splineflags.animId; }
|
||||
|
||||
@@ -199,6 +199,25 @@ namespace Movement
|
||||
args.flags.EnableFacingAngle();
|
||||
}
|
||||
|
||||
void MoveSplineInit::MoveTo(Vector3 const& start, Vector3 const& dest, bool generatePath, bool forceDestination)
|
||||
{
|
||||
if (generatePath)
|
||||
{
|
||||
PathGenerator path(unit);
|
||||
bool result = path.CalculatePath(start.x, start.y, start.z, dest.x, dest.y, dest.z, forceDestination);
|
||||
if (result && !(path.GetPathType() & PATHFIND_NOPATH))
|
||||
{
|
||||
MovebyPath(path.GetPath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
args.path_Idx_offset = 0;
|
||||
args.path.resize(2);
|
||||
TransportPathTransform transform(unit, args.TransformForTransport);
|
||||
args.path[1] = transform(dest);
|
||||
}
|
||||
|
||||
void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
|
||||
{
|
||||
if (generatePath)
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Movement
|
||||
|
||||
/* Initializes simple A to B motion, A is current unit's position, B is destination
|
||||
*/
|
||||
void MoveTo(Vector3 const& start, Vector3 const& destination, bool generatePath = true, bool forceDestination = false);
|
||||
void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
|
||||
void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user