Panda3D
Public Member Functions | Public Attributes | List of all members
PathFollow Class Reference

Public Member Functions

 PathFollow (AICharacter *ai_ch, float follow_wt)
 
void add_to_path (LVecBase3 pos)
 This function adds the positions generated from a pathfind or a simple path follow behavior to the _path list. More...
 
bool check_if_possible ()
 This function checks if the current positions of the ai char and the target char can be used to generate an optimal path. More...
 
void do_follow ()
 This function allows continuous path finding by ai chars. More...
 
void start (std::string type)
 This function initiates the path follow behavior. More...
 

Public Attributes

AICharacter_ai_char
 
int _curr_path_waypoint
 
NodePath _dummy
 
float _follow_weight
 
ClockObject_myClock
 
std::vector< LVecBase3 > _path
 
bool _start
 
float _time
 
std::string _type
 

Detailed Description

Definition at line 11 of file pathFollow.h.

Member Function Documentation

◆ add_to_path()

void PathFollow::add_to_path ( LVecBase3  pos)

This function adds the positions generated from a pathfind or a simple path follow behavior to the _path list.

Definition at line 19 of file pathFollow.cxx.

Referenced by AIBehaviors::add_to_path().

◆ check_if_possible()

bool PathFollow::check_if_possible ( )

This function checks if the current positions of the ai char and the target char can be used to generate an optimal path.

Definition at line 105 of file pathFollow.cxx.

References find_in_mesh(), and NodePath::get_pos().

Referenced by do_follow().

◆ do_follow()

void PathFollow::do_follow ( )

This function allows continuous path finding by ai chars.

There are 2 ways in which this is implemented. 1. The character re-calculates the optimal path everytime the target changes its position. Less computationally expensive. 2. The character continuosly re-calculates its optimal path to the target. This is used in a scenario where the ai chars have to avoid other ai chars. More computationally expensive.

Definition at line 46 of file pathFollow.cxx.

References check_if_possible(), PathFind::do_dynamic_avoid(), NodePath::get_pos(), ClockObject::get_real_time, and PathFind::path_find().

Referenced by AIBehaviors::calculate_prioritized().

◆ start()

void PathFollow::start ( std::string  type)

This function initiates the path follow behavior.

Definition at line 26 of file pathFollow.cxx.

References NodePath::attach_new_node(), ClockObject::get_real_time, and AIBehaviors::pursue().

Referenced by AIBehaviors::start_follow().


The documentation for this class was generated from the following files: