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

A class that implements the virtual AI world which keeps track of the AI characters active at any given time. More...

Public Member Functions

 __init__ (const AIWorld)
 
 __init__ (NodePath render)
 
 addAiChar (AICharacter ai_ch)
 
 addFlock (Flock flock)
 This function adds all the AI characters in the Flock object to the AICharPool. More...
 
 addObstacle (NodePath obstacle)
 This function adds the nodepath as an obstacle that is needed by the obstacle avoidance behavior. More...
 
 flockOff (unsigned int flock_id)
 This function turns off the flock behavior temporarily. More...
 
 flockOn (unsigned int flock_id)
 This function turns on the flock behavior. More...
 
Flock getFlock (unsigned int flock_id)
 This function returns a handle to the Flock whose id is passed. More...
 
 printList ()
 This function prints the names of the AI characters that have been added to the AIWorld. More...
 
 removeAiChar (str name)
 
 removeFlock (unsigned int flock_id)
 This function removes the flock behavior completely. More...
 
 removeObstacle (NodePath obstacle)
 This function removes the nodepath from the obstacles list that is needed by the obstacle avoidance behavior. More...
 
 update ()
 The AIWorld update function calls the update function of all the AI characters which have been added to the AIWorld. More...
 

Detailed Description

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.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const  AIWorld)

◆ __init__() [2/2]

__init__ ( NodePath  render)

◆ addAiChar()

addAiChar ( AICharacter  ai_ch)

◆ addFlock()

addFlock ( 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.

◆ addObstacle()

addObstacle ( NodePath  obstacle)

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

◆ flockOff()

flockOff ( unsigned int  flock_id)

This function turns off the flock behavior temporarily.

Similar to pausing the behavior.

◆ flockOn()

flockOn ( unsigned int  flock_id)

This function turns on the flock behavior.

◆ getFlock()

Flock getFlock ( unsigned int  flock_id)

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

◆ printList()

printList ( )

This function prints the names of the AI characters that have been added to the AIWorld.

Useful for debugging purposes.

◆ removeAiChar()

removeAiChar ( str  name)

◆ removeFlock()

removeFlock ( unsigned int  flock_id)

This function removes the flock behavior completely.

◆ removeObstacle()

removeObstacle ( NodePath  obstacle)

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

◆ update()

update ( )

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