Panda3D
pathFind.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file pathFind.h
10  * @author Deepak, John, Navin
11  * @date 2009-10-12
12  */
13 
14 #ifndef _PATHFIND_H
15 #define _PATHFIND_H
16 
17 #include "aiGlobals.h"
18 #include "aiCharacter.h"
19 #include "aiPathFinder.h"
20 #include "boundingSphere.h"
21 
22 class AICharacter;
23 
24 /**
25  * This class contains all the members and functions that are required to form
26  * an interface between the AIBehaviors class and the PathFinder class. An
27  * object (pointer) of this class is provided in the AIBehaviors class. It is
28  * only via this object that the user can activate pathfinding.
29  */
30 class EXPCL_PANDAAI PathFind {
31 public:
32  AICharacter *_ai_char;
33  PathFinder *_path_finder_obj;
34 
35  NavMesh _nav_mesh;
36  NavMesh _stage_mesh;
37 
38  int _grid_size;
39  NodePath _path_find_target;
40  LVecBase3 _prev_position;
41  PT(GeomNode) _parent;
42  LineSegs *_pen;
43  std::vector<int> _previous_obstacles;
44  bool _dynamic_avoid;
45  std::vector<NodePath> _dynamic_obstacle;
46 
47  PathFind(AICharacter *ai_ch);
48  ~PathFind();
49 
50  void clear_path();
51  void trace_path(Node* src);
52 
53  void create_nav_mesh(const char* navmesh_filename);
54  void assign_neighbor_nodes(const char* navmesh_filename);
55  void do_dynamic_avoid();
56  void clear_previous_obstacles();
57 
58  void set_path_find(const char* navmesh_filename);
59  void path_find(LVecBase3 pos, std::string type = "normal");
60  void path_find(NodePath target, std::string type = "normal");
61  void add_obstacle_to_mesh(NodePath obstacle);
62  void dynamic_avoid(NodePath obstacle);
63 };
64 
65 #endif
This class is used to assign the nodes on the mesh.
Definition: meshNode.h:16
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class implements pathfinding using A* algorithm.
Definition: aiPathFinder.h:31
Encapsulates creation of a series of connected or disconnected line segments or points,...
Definition: lineSegs.h:33
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class contains all the members and functions that are required to form an interface between the ...
Definition: pathFind.h:30
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
A node that holds Geom objects, renderable pieces of geometry.
Definition: geomNode.h:34