Panda3D Manual: Steering BehaviorsThese AI behaviors control the basic motion of NPC objects in a game and make it look realistic. PandAI is inbuilt with handling the functionality of the seven following basic steering behaviors : Seek Flee Pursue Evade Arrival Wander Flock Obstacle Avoidance Path Follow Before you start exploring these various behaviors, let me give you a brief introduction on how it is setup and what you need to begin : All the Steering Behaviors are part of the Behavior class of any AI Character. Hence, to use them you need to get a reference to it via 'getAiBehaviors()' function of the AICharacter class. Once you get this reference, you can use it to call any steering behavior. //For example:
Every steering behavior can also take a second parameter which is priority. This ranges from 0 to 1 and it defines the behaviors intensity when combined with other behaviors. //For example: This will cause the AICharacter's resultant force to be an equal balance of seeking 'targetNodePath_1' and fleeing 'targetNodePath_2' .
HELPER FUNCTIONS : (For beginners -> Come back to these when you need this functionality)
void addAiChar(AICharacter aiChar); For the AICharacter class: double getMass(); For the AIBehaviors class: aiBehaviors.behaviorStatus(string AIName) This function returns the status of an AI Behavior whether it is active, paused, done or disabled. Returns -1 if an invalid string is passed.
void removeAi(string "AIName");
void pauseAi(string "AIName"); where AIName refers to: "all" - removes all the Ai's "seek" - removes seek "flee" - removes flee "pursue" - removes arrival "evade" - removes pursuit "arrival" - removes evade "wander" - removes wander "flock" - removes flock "obstacle_avoidance" - removes obstacle_avoidance "pathfollow" - removes pathfollow
© Carnegie Mellon University 2010 |