Core/Movement: implement smooth waypoints
* delays can now be negative to support sniffed transition times from one waypoint path to another * early transitions will now pick up the ongoing spline destination and start calculating their path from that point on * waypoints may now use db side spline pathings in a new db table to support special spline shapes are not generated by normal pathfinding (e.g. scripted flight paths) * current waypoints will still the work the way they did before for legacy and custom support
This commit is contained in:
1 parent
4a158fdf22
commit
d5f9b8c26f
11 files changed
+266
-164
No files matched your search
@@ -19,6 +19,7 @@
|
||||
#include "PathGenerator.h"
|
||||
#include "Map.h"
|
||||
#include "Creature.h"
|
||||
#include "G3DPosition.hpp"
|
||||
#include "MMapFactory.h"
|
||||
#include "MMapManager.h"
|
||||
#include "Log.h"
|
||||
@@ -55,21 +56,20 @@ PathGenerator::~PathGenerator()
|
||||
TC_LOG_DEBUG("maps.mmaps", "++ PathGenerator::~PathGenerator() for %u", _source->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest)
|
||||
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest /*= false*/)
|
||||
{
|
||||
float x, y, z;
|
||||
_source->GetPosition(x, y, z);
|
||||
return CalculatePath(PositionToVector3(_source->GetPosition()), G3D::Vector3(destX, destY, destZ), forceDest);
|
||||
}
|
||||
|
||||
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
|
||||
bool PathGenerator::CalculatePath(G3D::Vector3 const& startPoint, G3D::Vector3 const& endPoint, bool forceDest /*= false*/)
|
||||
{
|
||||
if (!Trinity::IsValidMapCoord(startPoint.x, startPoint.y, startPoint.z) || !Trinity::IsValidMapCoord(endPoint.x, endPoint.y, endPoint.z))
|
||||
return false;
|
||||
|
||||
TC_METRIC_EVENT("mmap_events", "CalculatePath", "");
|
||||
|
||||
G3D::Vector3 dest(destX, destY, destZ);
|
||||
SetEndPosition(dest);
|
||||
|
||||
G3D::Vector3 start(x, y, z);
|
||||
SetStartPosition(start);
|
||||
SetEndPosition(endPoint);
|
||||
SetStartPosition(startPoint);
|
||||
|
||||
_forceDestination = forceDest;
|
||||
|
||||
@@ -79,7 +79,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo
|
||||
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
|
||||
const Unit* _sourceUnit = _source->ToUnit();
|
||||
if (!_navMesh || !_navMeshQuery || (_sourceUnit && _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING)) ||
|
||||
!HaveTile(start) || !HaveTile(dest))
|
||||
!HaveTile(startPoint) || !HaveTile(endPoint))
|
||||
{
|
||||
BuildShortcut();
|
||||
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
|
||||
@@ -88,7 +88,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo
|
||||
|
||||
UpdateFilter();
|
||||
|
||||
BuildPolyPath(start, dest);
|
||||
BuildPolyPath(startPoint, endPoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user