19 double relax_distance,
float flee_wt){
23 _flee_position = target_object.
get_pos(_ai_char->_window_render);
24 _flee_distance = panic_distance;
25 _flee_weight = flee_wt;
26 _flee_relax_distance = relax_distance;
29 _flee_activate_done =
false;
33 double relax_distance,
float flee_wt){
38 _flee_distance = panic_distance;
39 _flee_weight = flee_wt;
40 _flee_relax_distance = relax_distance;
43 _flee_activate_done =
false;
65 dirn = _ai_char->_ai_char_np.
get_pos(_ai_char->_window_render) - _flee_present_pos;
67 desired_force = _flee_direction * _ai_char->_movt_force;
69 if(distance > (_flee_distance + _flee_relax_distance)) {
70 if((_ai_char->_steering->_behaviors_flags | _ai_char->_steering->_flee) == _ai_char->_steering->_flee) {
71 _ai_char->_steering->_steering_force =
LVecBase3(0.0, 0.0, 0.0);
74 _ai_char->_steering->
turn_off(
"flee");
75 _ai_char->_steering->
turn_on(
"flee_activate");
79 return(desired_force);
96 _flee_activate_done =
false;
98 dirn = (_ai_char->_ai_char_np.
get_pos(_ai_char->_window_render) - _flee_position);
101 if(distance < _flee_distance) {
102 _flee_direction = _ai_char->_ai_char_np.
get_pos(_ai_char->_window_render) - _flee_position;
104 _flee_present_pos = _ai_char->_ai_char_np.
get_pos(_ai_char->_window_render);
105 _ai_char->_steering->
turn_off(
"flee_activate");
106 _ai_char->_steering->
turn_on(
"flee");
107 _flee_activate_done =
true;
This is the base class for all three-component vectors and points.
LVecBase3 do_flee()
This function performs the flee and returns a flee force which is used in the calculate_prioritized f...
float length() const
Returns the length of the vector, by the Pythagorean theorem.
LPoint3 get_pos() const
Retrieves the translation component of the transform.
void turn_off(string ai_type)
This function turns off any aiBehavior which is passed as a string.
void turn_on(string ai_type)
This function turns on any aiBehavior which is passed as a string.
void flee_activate()
This function checks for whether the target is within the panic distance.
bool normalize()
Normalizes the vector in place.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...