panda3d.ai.AIBehaviors

class AIBehaviors

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.

Inheritance diagram

Inheritance diagram of AIBehaviors

__init__(param0: AIBehaviors) → None
seek(pos: LVecBase3, seek_wt: float) → None
seek(target_object: NodePath, seek_wt: float) → None

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.

flee(pos: LVecBase3, panic_distance: float, relax_distance: float, flee_wt: float) → None
flee(target_object: NodePath, panic_distance: float, relax_distance: float, flee_wt: float) → None

This function activates flee_activate and creates an object of the Flee class. This function is overloaded to accept a NodePath or an LVecBase3.

pursue(target_object: NodePath, pursue_wt: float) → None

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

evade(target_object: NodePath, panic_distance: float, relax_distance: float, evade_wt: float) → None

This function activates evade_activate.

arrival(distance: float) → None

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

flock(flock_wt: float) → None

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

wander(wander_radius: float, flag: int, aoe: float, wander_weight: float) → None

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

obstacleAvoidance(feeler_length: float) → None

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.

pathFollow(follow_wt: float) → None

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

addToPath(pos: LVecBase3) → None

This function adds positions to the path to follow.

startFollow(type: str) → None
initPathFind(navmesh_filename: str) → None

This function activates path finding in the character. This function accepts the meshdata in .csv format.

pathFindTo(pos: LVecBase3, type: str) → None

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(target: NodePath, type: str) → None

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.

addStaticObstacle(obstacle: NodePath) → None

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.

addDynamicObstacle(obstacle: NodePath) → None

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

removeAi(ai_type: str) → None

This function removes individual or all the AIs.

pauseAi(ai_type: str) → None

This function pauses individual or all the AIs.

resumeAi(ai_type: str) → None

This function resumes individual or all the AIs

behaviorStatus(ai_type: str) → str

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.