OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
navigation_recast_path.h
1/*
2===========================================================================
3Copyright (C) 2025 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25#include "navigation_path.h"
26
27class dtNavMesh;
28class dtPathCorridor;
29class NavigationMap;
30struct DetourData;
31
36class RecastPather : public IPather
37{
38public:
39 RecastPather();
40 ~RecastPather();
41
42 virtual void FindPath(const Vector& start, const Vector& end, const PathSearchParameter& parameters) override;
43 virtual void
44 FindPathNear(const Vector& start, const Vector& end, float radius, const PathSearchParameter& parameters) override;
45 virtual void FindPathAway(
46 const Vector& start,
47 const Vector& avoid,
48 const Vector& preferredDir,
49 float radius,
50 const PathSearchParameter& parameters
51 ) override;
52 virtual bool TestPath(const Vector& start, const Vector& end, const PathSearchParameter& parameters) override;
53
54 virtual void UpdatePos(const Vector& origin) override;
55 virtual void Clear() override;
56
57 virtual PathNav GetNode(unsigned int index) const override;
58 virtual int GetNodeCount() const override;
59 virtual Vector GetCurrentDelta() const override;
60 virtual Vector GetCurrentDirection() const override;
61 virtual Vector GetDestination() const override;
62 virtual bool HasReachedGoal(const Vector& origin) const override;
63 virtual bool IsQuerying() const override;
64
65private:
66 void ResetPosition(const Vector& origin);
67
68private:
69 DetourData *detourData;
70 bool moving;
71 Vector lastorg;
72 Vector lastValidOrg;
73 Vector currentNodePos;
74 int lastCheckTime;
75 int traversingOffMeshLink;
76};
77
79{
80public:
81 void PostLoadNavigation(const NavigationMap& map);
82 void ClearNavigation();
83 void Update();
84};
85
86extern RecastPathMaster pathMaster;
Definition navigation_path.h:43
Full navigation map with meshes and tiles.
Definition navigation_recast_load.h:47
Definition navigation_recast_path.h:79
virtual void FindPath(const Vector &start, const Vector &end, const PathSearchParameter &parameters) override
Find and set the path from start to end.
Definition navigation_recast_path.cpp:69
virtual bool HasReachedGoal(const Vector &origin) const override
Return true if the origin is at the end of the goal.
Definition navigation_recast_path.cpp:515
virtual void UpdatePos(const Vector &origin) override
Update path movement.
Definition navigation_recast_path.cpp:299
virtual Vector GetDestination() const override
Return the final destination.
Definition navigation_recast_path.cpp:506
virtual int GetNodeCount() const override
Return the number of nodes.
Definition navigation_recast_path.cpp:478
virtual bool IsQuerying() const override
Return true if the path is currently being calculated.
Definition navigation_recast_path.cpp:529
virtual Vector GetCurrentDirection() const override
Return the directional vector towards the path.
Definition navigation_recast_path.cpp:496
virtual Vector GetCurrentDelta() const override
Return the current move delta.
Definition navigation_recast_path.cpp:487
virtual void FindPathNear(const Vector &start, const Vector &end, float radius, const PathSearchParameter &parameters) override
Find and set the path from start to end with the specified goal radius.
Definition navigation_recast_path.cpp:113
virtual void Clear() override
Clear the path.
Definition navigation_recast_path.cpp:389
virtual void FindPathAway(const Vector &start, const Vector &avoid, const Vector &preferredDir, float radius, const PathSearchParameter &parameters) override
Find and set the path away from the specified origin.
Definition navigation_recast_path.cpp:167
virtual bool TestPath(const Vector &start, const Vector &end, const PathSearchParameter &parameters) override
Returns true if the path exists, false otherwise.
Definition navigation_recast_path.cpp:248
virtual PathNav GetNode(unsigned int index) const override
Return the node at the specified index (0 = first node, and nodecount - 1 = last node).
Definition navigation_recast_path.cpp:394
Definition vector.h:61
Definition navigation_recast_path.cpp:44
Definition navigation_path.h:29
Definition navigation_path.h:35