18#ifndef _PATH_GENERATOR_H
19#define _PATH_GENERATOR_H
21#include "DetourNavMesh.h"
22#include "DetourNavMeshQuery.h"
25#include <G3D/Vector3.h>
32#define MAX_PATH_LENGTH 74
33#define MAX_POINT_PATH_LENGTH 74
35#define SMOOTH_PATH_STEP_SIZE 4.0f
36#define SMOOTH_PATH_SLOP 0.3f
39#define INVALID_POLYREF 0
68 bool CalculatePath(
float srcX,
float srcY,
float srcZ,
float destX,
float destY,
float destZ,
bool forceDest =
false);
69 bool CalculatePath(
float destX,
float destY,
float destZ,
bool forceDest =
false);
70 bool IsInvalidDestinationZ(
WorldObject const* target)
const;
83 float GetPathLength()
const;
88 void ShortenPathUntilDist(G3D::Vector3
const& target,
float dist);
114 void SetEndPosition(G3D::Vector3
const& point) { _actualEndPosition = point; _endPosition = point; }
116 void NormalizePath();
124 bool InRange(G3D::Vector3
const& p1, G3D::Vector3
const& p2,
float r,
float h)
const;
125 float Dist3DSqr(G3D::Vector3
const& p1, G3D::Vector3
const& p2)
const;
126 bool InRangeYZX(
float const*
v1,
float const*
v2,
float r,
float h)
const;
128 dtPolyRef GetPathPolyByPosition(dtPolyRef
const* polyPath,
uint32 polyPathSize,
float const* Point,
float* Distance =
nullptr)
const;
129 dtPolyRef GetPolyByLocation(
float const* Point,
float* Distance)
const;
130 bool HaveTile(G3D::Vector3
const& p)
const;
132 void BuildPolyPath(G3D::Vector3
const& startPos, G3D::Vector3
const& endPos);
133 void BuildPointPath(
float const* startPoint,
float const* endPoint);
134 void BuildShortcut();
142 bool GetSteerTarget(
float const* startPos,
float const* endPos,
float minTargetDist, dtPolyRef
const* path,
uint32 pathSize,
float* steerPos,
143 unsigned char& steerPosFlag, dtPolyRef& steerPosRef);
144 dtStatus FindSmoothPath(
float const* startPos,
float const* endPos,
145 dtPolyRef
const* polyPath,
uint32 polyPathSize,
146 float* smoothPath,
int* smoothPathSize,
uint32 maxSmoothPathSize);
148 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
PathGenerator(PathGenerator const &right)=delete
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
PathGenerator(PathGenerator &&right)=delete
dtNavMesh const * _navMesh
PathGenerator & operator=(PathGenerator &&right)=delete
void SetEndPosition(G3D::Vector3 const &point)
void SetUseStraightPath(bool useStraightPath)
PathGenerator & operator=(PathGenerator const &right)=delete
G3D::Vector3 const & GetActualEndPosition() const
G3D::Vector3 _endPosition
std::vector< Vector3 > PointsArray