00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _PATHFIND_H
00018 #define _PATHFIND_H
00019
00020 #include "aiGlobals.h"
00021 #include "aiCharacter.h"
00022 #include "aiPathFinder.h"
00023 #include "boundingSphere.h"
00024
00025 class AICharacter;
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDAAI PathFind {
00037 public:
00038 AICharacter *_ai_char;
00039 PathFinder *_path_finder_obj;
00040
00041 NavMesh _nav_mesh;
00042 NavMesh _stage_mesh;
00043
00044 int _grid_size;
00045 NodePath _path_find_target;
00046 LVecBase3f _prev_position;
00047 PT(GeomNode) _parent;
00048 LineSegs *_pen;
00049 vector<int> _previous_obstacles;
00050 bool _dynamic_avoid;
00051 vector<NodePath> _dynamic_obstacle;
00052
00053 PathFind(AICharacter *ai_ch);
00054 ~PathFind();
00055
00056 void clear_path();
00057 void trace_path(Node* src);
00058
00059 void create_nav_mesh(const char* navmesh_filename);
00060 void assign_neighbor_nodes(const char* navmesh_filename);
00061 void do_dynamic_avoid();
00062 void clear_previous_obstacles();
00063
00064 void set_path_find(const char* navmesh_filename);
00065 void path_find(LVecBase3f pos, string type = "normal");
00066 void path_find(NodePath target, string type = "normal");
00067 void add_obstacle_to_mesh(NodePath obstacle);
00068 void dynamic_avoid(NodePath obstacle);
00069 };
00070
00071 #endif
00072