31typedef std::list<Flee, std::allocator<Flee> > ListFlee;
32typedef std::list<Evade, std::allocator<Evade> > ListEvade;
44class EXPCL_PANDAAI AIBehaviors {
50 _flee_activate = 0x00100,
52 _arrival_activate = 0x01000,
56 _evade_activate = 0x00800,
58 _flock_activate = 0x00400,
59 _obstacle_avoidance = 0x02000,
60 _obstacle_avoidance_activate = 0x04000
67 LVecBase3 _steering_force;
70 LVecBase3 _seek_force;
73 LVecBase3 _flee_force;
78 ListFlee::iterator _flee_itr;
81 LVecBase3 _pursue_force;
84 LVecBase3 _evade_force;
88 ListEvade _evade_list;
89 ListEvade::iterator _evade_itr;
92 LVecBase3 _arrival_force;
97 LVecBase3 _flock_force;
101 LVecBase3 _wander_force;
104 LVecBase3 _obstacle_avoidance_force;
110 bool _conflict, _previous_conflict;
115 bool is_on(_behavior_type bt);
116 bool is_on(std::string ai_type);
117 bool is_off(_behavior_type bt);
118 bool is_off(std::string ai_type);
119 void turn_on(std::string ai_type);
134 void seek(LVecBase3 pos,
float seek_wt = 1.0);
136 void flee(
NodePath target_object,
double panic_distance = 10.0,
double relax_distance = 10.0,
float flee_wt = 1.0);
137 void flee(LVecBase3 pos,
double panic_distance = 10.0,
double relax_distance = 10.0,
float flee_wt = 1.0);
141 void evade(
NodePath target_object,
double panic_distance = 10.0,
double relax_distance = 10.0,
float evade_wt = 1.0);
143 void arrival(
double distance = 10.0);
145 void flock(
float flock_wt);
147 void wander(
double wander_radius = 5.0,
int flag =0,
double aoe = 0.0,
float wander_weight = 1.0);
157 void path_find_to(LVecBase3 pos, std::string type =
"normal");
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void accumulate_force(std::string force_type, LVecBase3 force)
This function updates the individual steering forces for each of the ai characters.
void init_path_find(const char *navmesh_filename)
This function activates path finding in the character.
void pursue(NodePath target_object, float pursue_wt=1.0)
This function activates pursue.
void add_dynamic_obstacle(NodePath obstacle)
This function starts the pathfinding obstacle navigation for the passed in obstacle.
void resume_ai(std::string ai_type)
This function resumes individual or all the AIs.
void flee(NodePath target_object, double panic_distance=10.0, double relax_distance=10.0, float flee_wt=1.0)
This function activates flee_activate and creates an object of the Flee class.
void turn_on(std::string ai_type)
This function turns on any aiBehavior which is passed as a string.
void evade(NodePath target_object, double panic_distance=10.0, double relax_distance=10.0, float evade_wt=1.0)
This function activates evade_activate.
void turn_off(std::string ai_type)
This function turns off any aiBehavior which is passed as a string.
void add_static_obstacle(NodePath obstacle)
This function allows the user to dynamically add obstacles to the game environment.
void obstacle_avoidance(float feeler_length=1.0)
This function activates obstacle avoidance for a given character.
void path_find_to(LVecBase3 pos, std::string type="normal")
This function checks for the source and target in the navigation mesh for its availability and then f...
bool is_off(_behavior_type bt)
This function returns true if an aiBehavior is off.
void path_follow(float follow_wt=1.0f)
This function activates path following.
void start_follow(std::string type="normal")
This function starts the path follower.
void wander(double wander_radius=5.0, int flag=0, double aoe=0.0, float wander_weight=1.0)
This function activates wander.
void remove_ai(std::string ai_type)
This function removes individual or all the AIs.
LVecBase3 calculate_prioritized()
This function updates the main steering force for the ai character using the accumulate function and ...
std::string behavior_status(std::string ai_type)
This function returns the status of an AI Type whether it is active, paused or disabled.
void arrival(double distance=10.0)
This function activates arrival.
void flock(float flock_wt)
This function activates flock.
void add_to_path(LVecBase3 pos)
This function adds positions to the path to follow.
void pause_ai(std::string ai_type)
This function pauses individual or all the AIs.
bool is_on(_behavior_type bt)
This function returns true if an aiBehavior is on.
void flock_activate()
This function checks whether any other behavior exists to work with flock.
LVecBase3 do_flock()
This function contains the logic for flocking behavior.
void seek(NodePath target_object, float seek_wt=1.0)
This function activates seek and makes an object of the Seek class.
int char_to_int(std::string ai_type)
This function is used to derive int values from the ai types strings.
bool is_conflict()
Checks for conflict between steering forces.
This class is used to define the flock attributes and the AI characters which are part of the flock.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
This class contains all the members and functions that are required to form an interface between the ...