Panda3D
Loading...
Searching...
No Matches
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.
 
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.
 
void do_follow ()
 This function allows continuous path finding by ai chars.
 
void start (std::string type)
 This function initiates the path follow behavior.
 

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.

Constructor & Destructor Documentation

◆ PathFollow()

PathFollow::PathFollow ( AICharacter * ai_ch,
float follow_wt )

Definition at line 18 of file pathFollow.cxx.

◆ ~PathFollow()

PathFollow::~PathFollow ( )

Definition at line 26 of file pathFollow.cxx.

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 33 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 119 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 60 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 40 of file pathFollow.cxx.

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

Referenced by AIBehaviors::start_follow().

Member Data Documentation

◆ _ai_char

AICharacter* PathFollow::_ai_char

Definition at line 14 of file pathFollow.h.

◆ _curr_path_waypoint

int PathFollow::_curr_path_waypoint

Definition at line 17 of file pathFollow.h.

◆ _dummy

NodePath PathFollow::_dummy

Definition at line 19 of file pathFollow.h.

◆ _follow_weight

float PathFollow::_follow_weight

Definition at line 15 of file pathFollow.h.

◆ _myClock

ClockObject* PathFollow::_myClock

Definition at line 21 of file pathFollow.h.

◆ _path

std::vector<LVecBase3> PathFollow::_path

Definition at line 16 of file pathFollow.h.

◆ _start

bool PathFollow::_start

Definition at line 18 of file pathFollow.h.

◆ _time

float PathFollow::_time

Definition at line 22 of file pathFollow.h.

◆ _type

std::string PathFollow::_type

Definition at line 20 of file pathFollow.h.


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