fix(Core/Movement): correct weird pathing by clearing old path (#7034)
- Closes #5220.
This commit is contained in:
@@ -111,6 +111,12 @@ class PathGenerator
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
_polyLength = 0;
|
||||||
|
_pathPoints.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]; // array of detour polygon references
|
dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]; // array of detour polygon references
|
||||||
uint32 _polyLength; // number of polygons in the path
|
uint32 _polyLength; // number of polygons in the path
|
||||||
@@ -139,12 +145,6 @@ class PathGenerator
|
|||||||
void SetActualEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; }
|
void SetActualEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; }
|
||||||
void NormalizePath();
|
void NormalizePath();
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
_polyLength = 0;
|
|
||||||
_pathPoints.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
|
bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
|
||||||
float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
|
float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
|
||||||
bool InRangeYZX(float const* v1, float const* v2, float r, float h) const;
|
bool InRangeYZX(float const* v1, float const* v2, float r, float h) const;
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
|
|
||||||
if (!i_path || moveToward != _movingTowards)
|
if (!i_path || moveToward != _movingTowards)
|
||||||
i_path = std::make_unique<PathGenerator>(owner);
|
i_path = std::make_unique<PathGenerator>(owner);
|
||||||
|
else
|
||||||
|
i_path->Clear();
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
bool shortenPath;
|
bool shortenPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user