Panda3D
Public Member Functions | List of all members
AIBehaviors Class Reference

This class implements all the steering behaviors of the AI framework, such as seek, flee, pursue, evade, wander and flock. More...

Public Member Functions

 __init__ (const AIBehaviors)
 
 addDynamicObstacle (NodePath obstacle)
 This function starts the pathfinding obstacle navigation for the passed in obstacle. More...
 
 addStaticObstacle (NodePath obstacle)
 This function allows the user to dynamically add obstacles to the game environment. More...
 
 addToPath (LVecBase3 pos)
 This function adds positions to the path to follow. More...
 
 arrival (double distance)
 This function activates arrival. More...
 
str behaviorStatus (str ai_type)
 This function returns the status of an AI Type whether it is active, paused or disabled. More...
 
 evade (NodePath target_object, double panic_distance, double relax_distance, float evade_wt)
 This function activates evade_activate. More...
 
 flee (LVecBase3 pos, double panic_distance, double relax_distance, float flee_wt)
 
 flee (NodePath target_object, double panic_distance, double relax_distance, float flee_wt)
 This function activates flee_activate and creates an object of the Flee class. More...
 
 flock (float flock_wt)
 This function activates flock. More...
 
 initPathFind (str navmesh_filename)
 This function activates path finding in the character. More...
 
 obstacleAvoidance (float feeler_length)
 This function activates obstacle avoidance for a given character. More...
 
 pathFindTo (LVecBase3 pos, str type)
 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. More...
 
 pathFindTo (NodePath target, str type)
 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. More...
 
 pathFollow (float follow_wt)
 This function activates path following. More...
 
 pauseAi (str ai_type)
 This function pauses individual or all the AIs. More...
 
 pursue (NodePath target_object, float pursue_wt)
 This function activates pursue. More...
 
 removeAi (str ai_type)
 This function removes individual or all the AIs. More...
 
 resumeAi (str ai_type)
 This function resumes individual or all the AIs. More...
 
 seek (LVecBase3 pos, float seek_wt)
 
 seek (NodePath target_object, float seek_wt)
 This function activates seek and makes an object of the Seek class. More...
 
 startFollow (str type)
 
 wander (double wander_radius, int flag, double aoe, float wander_weight)
 This function activates wander. More...
 

Detailed Description

This class implements all the steering behaviors of the AI framework, such as seek, flee, pursue, evade, wander and flock.

Each steering behavior has a weight which is used when more than one type of steering behavior is acting on the same ai character. The weight decides the contribution of each type of steering behavior. The AICharacter class has a handle to an object of this class and this allows to invoke the steering behaviors via the AICharacter. This class also provides functionality such as pausing, resuming and removing the AI behaviors of an AI character at anytime.

Member Function Documentation

◆ __init__()

__init__ ( const  AIBehaviors)

◆ addDynamicObstacle()

addDynamicObstacle ( NodePath  obstacle)

This function starts the pathfinding obstacle navigation for the passed in obstacle.

◆ addStaticObstacle()

addStaticObstacle ( NodePath  obstacle)

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.

◆ addToPath()

addToPath ( LVecBase3  pos)

This function adds positions to the path to follow.

◆ arrival()

arrival ( double  distance)

This function activates arrival.

This is the function we want the user to call for arrival to be done.

◆ behaviorStatus()

str behaviorStatus ( str  ai_type)

This function returns the status of an AI Type whether it is active, paused or disabled.

It returns -1 if an invalid string is passed.

◆ evade()

evade ( NodePath  target_object,
double  panic_distance,
double  relax_distance,
float  evade_wt 
)

This function activates evade_activate.

◆ flee() [1/2]

flee ( LVecBase3  pos,
double  panic_distance,
double  relax_distance,
float  flee_wt 
)

◆ flee() [2/2]

flee ( NodePath  target_object,
double  panic_distance,
double  relax_distance,
float  flee_wt 
)

This function activates flee_activate and creates an object of the Flee class.

This function is overloaded to accept a NodePath or an LVecBase3.

◆ flock()

flock ( float  flock_wt)

This function activates flock.

This is the function we want the user to call for flock to be done.

◆ initPathFind()

initPathFind ( str  navmesh_filename)

This function activates path finding in the character.

This function accepts the meshdata in .csv format.

◆ obstacleAvoidance()

obstacleAvoidance ( float  feeler_length)

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.

◆ pathFindTo() [1/2]

pathFindTo ( LVecBase3  pos,
str  type 
)

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.

◆ pathFindTo() [2/2]

pathFindTo ( NodePath  target,
str  type 
)

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.

◆ pathFollow()

pathFollow ( float  follow_wt)

This function activates path following.

This is the function we want the user to call for path following.

◆ pauseAi()

pauseAi ( str  ai_type)

This function pauses individual or all the AIs.

◆ pursue()

pursue ( NodePath  target_object,
float  pursue_wt 
)

This function activates pursue.

This is the function we want the user to call for pursue to be done.

◆ removeAi()

removeAi ( str  ai_type)

This function removes individual or all the AIs.

◆ resumeAi()

resumeAi ( str  ai_type)

This function resumes individual or all the AIs.

◆ seek() [1/2]

seek ( LVecBase3  pos,
float  seek_wt 
)

◆ seek() [2/2]

seek ( NodePath  target_object,
float  seek_wt 
)

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 LVecBase3.

◆ startFollow()

startFollow ( str  type)

◆ wander()

wander ( double  wander_radius,
int  flag,
double  aoe,
float  wander_weight 
)

This function activates wander.

This is the function we want the user to call for flock to be done.