AIWorld

from panda3d.ai import AIWorld
class AIWorld

Bases:

A class that implements the virtual AI world which keeps track of the AI characters active at any given time. It contains a linked list of AI characters, obstactle data and unique name for each character. It also updates each characters state. The AI characters can also be added to the world as flocks.

Inheritance diagram

Inheritance diagram of AIWorld

__init__(param0: AIWorld)
__init__(render: panda3d.core.NodePath)
add_ai_char(ai_ch: AICharacter)
add_flock(flock: Flock)

This function adds all the AI characters in the Flock object to the AICharPool. This function allows adding the AI characetrs as part of a flock.

add_obstacle(obstacle: panda3d.core.NodePath)

This function adds the nodepath as an obstacle that is needed by the obstacle avoidance behavior.

flock_off(flock_id: int)

This function turns off the flock behavior temporarily. Similar to pausing the behavior.

flock_on(flock_id: int)

This function turns on the flock behavior.

get_flock(flock_id: int) Flock

This function returns a handle to the Flock whose id is passed.

print_list()

This function prints the names of the AI characters that have been added to the AIWorld. Useful for debugging purposes.

remove_ai_char(name: str)
remove_flock(flock_id: int)

This function removes the flock behavior completely.

remove_obstacle(obstacle: panda3d.core.NodePath)

This function removes the nodepath from the obstacles list that is needed by the obstacle avoidance behavior.

update()

The AIWorld update function calls the update function of all the AI characters which have been added to the AIWorld.