18#ifndef _PATH_GENERATOR_H
19#define _PATH_GENERATOR_H
22#include "DetourNavMesh.h"
23#include "DetourNavMeshQuery.h"
25#include <G3D/Vector3.h>
33#define MAX_PATH_LENGTH 74
34#define MAX_POINT_PATH_LENGTH 74
36#define SMOOTH_PATH_STEP_SIZE 4.0f
37#define SMOOTH_PATH_SLOP 0.3f
40#define INVALID_POLYREF 0
64 bool CalculatePath(
float destX,
float destY,
float destZ,
bool forceDest =
false);
65 bool IsInvalidDestinationZ(
Unit const* target)
const;
82 void ShortenPathUntilDist(G3D::Vector3
const& point,
float dist);
108 void SetEndPosition(G3D::Vector3
const& point) { _actualEndPosition = point; _endPosition = point; }
110 void NormalizePath();
118 bool InRange(G3D::Vector3
const& p1, G3D::Vector3
const& p2,
float r,
float h)
const;
119 float Dist3DSqr(G3D::Vector3
const& p1, G3D::Vector3
const& p2)
const;
120 bool InRangeYZX(
float const* v1,
float const* v2,
float r,
float h)
const;
122 dtPolyRef GetPathPolyByPosition(dtPolyRef
const* polyPath,
uint32 polyPathSize,
float const* Point,
float* Distance =
nullptr)
const;
123 dtPolyRef GetPolyByLocation(
float const* Point,
float* Distance)
const;
124 bool HaveTile(G3D::Vector3
const& p)
const;
126 void BuildPolyPath(G3D::Vector3
const& startPos, G3D::Vector3
const& endPos);
127 void BuildPointPath(
float const* startPoint,
float const* endPoint);
128 void BuildShortcut();
136 bool GetSteerTarget(
float const* startPos,
float const* endPos,
float minTargetDist, dtPolyRef
const* path,
uint32 pathSize,
float* steerPos,
137 unsigned char& steerPosFlag, dtPolyRef& steerPosRef);
138 dtStatus FindSmoothPath(
float const* startPos,
float const* endPos,
139 dtPolyRef
const* polyPath,
uint32 polyPathSize,
140 float* smoothPath,
int* smoothPathSize,
uint32 smoothPathMaxSize);
142 void AddFarFromPolyFlags(
bool startFarFromPoly,
bool endFarFromPoly);
#define SMOOTH_PATH_STEP_SIZE
#define MAX_POINT_PATH_LENGTH
@ PATHFIND_FARFROMPOLY_END
@ PATHFIND_NOT_USING_PATH
@ PATHFIND_FARFROMPOLY_START
void SetUseRaycast(bool useRaycast)
Movement::PointsArray const & GetPath() const
G3D::Vector3 _startPosition
void SetActualEndPosition(G3D::Vector3 const &point)
G3D::Vector3 const & GetStartPosition() const
G3D::Vector3 _actualEndPosition
PathType GetPathType() const
dtNavMeshQuery const * _navMeshQuery
WorldObject const *const _source
G3D::Vector3 const & GetEndPosition() const
void SetPathLengthLimit(float distance)
void SetStartPosition(G3D::Vector3 const &point)
Movement::PointsArray _pathPoints
dtNavMesh const * _navMesh
void SetEndPosition(G3D::Vector3 const &point)
void SetUseStraightPath(bool useStraightPath)
G3D::Vector3 const & GetActualEndPosition() const
G3D::Vector3 _endPosition
std::vector< Vector3 > PointsArray