|
|
|
List of all members.
Public Types |
| enum | _behavior_type {
_none = 0x00000,
_seek = 0x00002,
_flee = 0x00004,
_flee_activate = 0x00100,
_arrival = 0x00008,
_arrival_activate = 0x01000,
_wander = 0x00010,
_pursue = 0x00040,
_evade = 0x00080,
_evade_activate = 0x00800,
_flock = 0x00200,
_flock_activate = 0x00400,
_obstacle_avoidance = 0x02000,
_obstacle_avoidance_activate = 0x04000
} |
Public Member Functions |
| void | accumulate_force (string force_type, LVecBase3f force) |
| | This function updates the individual steering forces for each of the ai characters.
|
| void | add_dynamic_obstacle (NodePath obstacle) |
| | This function starts the pathfinding obstacle navigation for the passed in obstacle.
|
| void | add_static_obstacle (NodePath obstacle) |
| | This function allows the user to dynamically add obstacles to the game environment.
|
| void | add_to_path (LVecBase3f pos) |
| | This function adds positions to the path to follow.
|
| void | arrival (double distance=10.0) |
| | This function activates arrival.
|
| string | behavior_status (string ai_type) |
| | This function returns the status of an AI Type whether it is active, paused or disabled.
|
| LVecBase3f | calculate_prioritized () |
| | This function updates the main steering force for the ai character using the accumulate function and checks for max force and arrival force.
|
| int | char_to_int (string ai_type) |
| | This function is used to derive int values from the ai types strings.
|
| LVecBase3f | do_flock () |
| | This function contains the logic for flocking behavior.
|
| 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 | 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 | flee (LVecBase3f pos, double panic_distance=10.0, double relax_distance=10.0, float flee_wt=1.0) |
| void | flock (float flock_wt) |
| | This function activates flock.
|
| void | flock_activate () |
| | This function checks whether any other behavior exists to work with flock.
|
| void | init_path_find (const char *navmesh_filename) |
| | This function activates path finding in the character.
|
| bool | is_conflict () |
| | Checks for conflict between steering forces.
|
| bool | is_off (_behavior_type bt) |
| | This function returns true if an aiBehavior is off.
|
| bool | is_off (string ai_type) |
| | This function returns true if pathfollow or pathfinding is off.
|
| bool | is_on (_behavior_type bt) |
| | This function returns true if an aiBehavior is on.
|
| bool | is_on (string ai_type) |
| | This function returns true if pathfollow or pathfinding is on.
|
| void | obstacle_avoidance (float feeler_length=1.0) |
| | This function activates obstacle avoidance for a given character.
|
| void | path_find_to (LVecBase3f pos, string type="normal") |
| | This function checks for the source and target in the navigation mesh for its availability and then finds the best path via the A* algorithm Then it calls the path follower to make the object follow the path.
|
| void | path_find_to (NodePath target, string type="normal") |
| | This function checks for the source and target in the navigation mesh for its availability and then finds the best path via the A* algorithm Then it calls the path follower to make the object follow the path.
|
| void | path_follow (float follow_wt) |
| | This function activates path following.
|
| void | pause_ai (string ai_type) |
| | This function pauses individual or all the AIs.
|
| void | pursue (NodePath target_object, float pursue_wt=1.0) |
| | This function activates pursue.
|
| void | remove_ai (string ai_type) |
| | This function removes individual or all the AIs.
|
| void | resume_ai (string ai_type) |
| | This function resumes individual or all the AIs.
|
| void | seek (NodePath target_object, float seek_wt=1.0) |
| | This function activates seek and makes an object of the Seek class.
|
|
void | seek (LVecBase3f pos, float seek_wt=1.0) |
| void | start_follow (string type="normal") |
| | This function starts the path follower.
|
| void | turn_off (string ai_type) |
| | This function turns off any aiBehavior which is passed as a string.
|
| void | turn_on (string ai_type) |
| | This function turns on any aiBehavior which is passed as a string.
|
| void | wander (double wander_radius=5.0, int flag=0, double aoe=0.0, float wander_weight=1.0) |
| | This function activates wander.
|
Public Attributes |
|
AICharacter * | _ai_char |
|
LVecBase3f | _arrival_force |
|
Arrival * | _arrival_obj |
|
int | _behaviors_flags |
|
bool | _conflict |
|
LVecBase3f | _evade_force |
|
ListEvade::iterator | _evade_itr |
| ListEvade | _evade_list |
| | This list is used if the ai character needs to evade from multiple onjects.
|
|
Evade * | _evade_obj |
|
LVecBase3f | _flee_force |
|
ListFlee::iterator | _flee_itr |
| ListFlee | _flee_list |
| | This list is used if the ai character needs to flee from multiple onjects.
|
|
Flee * | _flee_obj |
|
bool | _flock_done |
|
LVecBase3f | _flock_force |
|
Flock * | _flock_group |
| float | _flock_weight |
| | Since Flock is a collective behavior the variables are declared within the AIBehaviors class.
|
|
LVecBase3f | _obstacle_avoidance_force |
|
ObstacleAvoidance * | _obstacle_avoidance_obj |
|
PathFind * | _path_find_obj |
|
PathFollow * | _path_follow_obj |
|
bool | _previous_conflict |
|
LVecBase3f | _pursue_force |
|
Pursue * | _pursue_obj |
|
LVecBase3f | _seek_force |
|
Seek * | _seek_obj |
|
LVecBase3f | _steering_force |
|
LVecBase3f | _wander_force |
|
Wander * | _wander_obj |
Detailed Description
Definition at line 52 of file aiBehaviors.h.
Member Function Documentation
This function allows the user to dynamically add obstacles to the game environment.
The function will update the nodes within the bounding volume of the obstacle as non-traversable. Hence will not be considered by the pathfinding algorithm.
Definition at line 953 of file aiBehaviors.cxx.
References PathFind::add_obstacle_to_mesh().
This function activates arrival.
This is the function we want the user to call for arrival to be done.
Definition at line 714 of file aiBehaviors.cxx.
References turn_on().
This function updates the main steering force for the ai character using the accumulate function and checks for max force and arrival force.
It finally returns this steering force which is accessed by the update function in the AICharacter class.
Definition at line 172 of file aiBehaviors.cxx.
References _evade_list, _flee_list, _flock_weight, accumulate_force(), Arrival::arrival_activate(), Arrival::do_arrival(), do_flock(), PathFollow::do_follow(), ObstacleAvoidance::do_obstacle_avoidance(), Pursue::do_pursue(), Seek::do_seek(), Wander::do_wander(), flock_activate(), is_conflict(), is_on(), LVecBase3f::length(), LVecBase3f::normalize(), and ObstacleAvoidance::obstacle_avoidance_activate().
Referenced by AICharacter::update().
This function contains the logic for flocking behavior.
This is an emergent behavior and is obtained by combining three other behaviors which are separation, cohesion and alignment based on Craig Reynold's algorithm. Also, this behavior does not work by itself. It works only when combined with other steering behaviors such as wander, pursue, evade, seek and flee.
Definition at line 772 of file aiBehaviors.cxx.
References NodePath::get_pos(), is_on(), LVecBase3f::length(), LVecBase3f::normalize(), turn_off(), and turn_on().
Referenced by calculate_prioritized().
| void AIBehaviors::evade |
( |
NodePath |
target_object, |
|
|
double |
panic_distance = 10.0, |
|
|
double |
relax_distance = 10.0, |
|
|
float |
evade_wt = 1.0 |
|
) |
| |
| void AIBehaviors::flee |
( |
NodePath |
target_object, |
|
|
double |
panic_distance = 10.0, |
|
|
double |
relax_distance = 10.0, |
|
|
float |
flee_wt = 1.0 |
|
) |
| |
This function returns true if pathfollow or pathfinding is off.
Definition at line 1486 of file aiBehaviors.cxx.
This function returns true if pathfollow or pathfinding is on.
Definition at line 1446 of file aiBehaviors.cxx.
References is_on().
This function activates obstacle avoidance for a given character.
This is the function we want the user to call for obstacle avoidance to be performed.
Definition at line 864 of file aiBehaviors.cxx.
References turn_on().
This function checks for the source and target in the navigation mesh for its availability and then finds the best path via the A* algorithm Then it calls the path follower to make the object follow the path.
Definition at line 926 of file aiBehaviors.cxx.
References PathFind::path_find().
This function checks for the source and target in the navigation mesh for its availability and then finds the best path via the A* algorithm Then it calls the path follower to make the object follow the path.
Definition at line 939 of file aiBehaviors.cxx.
References PathFind::path_find().
This function activates seek and makes an object of the Seek class.
This is the function we want the user to call for seek to be done. This function is overloaded to accept a NodePath or an LVecBase3f.
Definition at line 646 of file aiBehaviors.cxx.
References turn_on().
This function turns off any aiBehavior which is passed as a string.
Definition at line 1327 of file aiBehaviors.cxx.
References char_to_int(), and is_on().
Referenced by Arrival::arrival_activate(), Arrival::do_arrival(), Evade::do_evade(), Flee::do_flee(), do_flock(), ObstacleAvoidance::do_obstacle_avoidance(), Seek::do_seek(), Evade::evade_activate(), Flee::flee_activate(), flock_activate(), ObstacleAvoidance::obstacle_avoidance_activate(), pause_ai(), remove_ai(), and resume_ai().
This function turns on any aiBehavior which is passed as a string.
Definition at line 1261 of file aiBehaviors.cxx.
References char_to_int().
Referenced by arrival(), Arrival::arrival_activate(), Arrival::do_arrival(), Evade::do_evade(), Flee::do_flee(), do_flock(), ObstacleAvoidance::do_obstacle_avoidance(), evade(), Evade::evade_activate(), flee(), Flee::flee_activate(), flock(), flock_activate(), obstacle_avoidance(), ObstacleAvoidance::obstacle_avoidance_activate(), pursue(), resume_ai(), seek(), and wander().
| void AIBehaviors::wander |
( |
double |
wander_radius = 5.0, |
|
|
int |
flag = 0, |
|
|
double |
aoe = 0.0, |
|
|
float |
wander_weight = 1.0 |
|
) |
| |
This function activates wander.
This is the function we want the user to call for flock to be done.
Definition at line 850 of file aiBehaviors.cxx.
References turn_on().
Member Data Documentation
The documentation for this class was generated from the following files:
| | |