fix: patrol navigation now first targets the closest point on the path
This commit is contained in:
parent
9517588415
commit
c05d3aa28f
4 changed files with 20 additions and 14 deletions
|
|
@ -52,8 +52,8 @@ void WretchedPatrolState::enter_state() {
|
|||
float const max_speed{ get_unit()->get_patrol_speed() };
|
||||
get_target()->set_movement_speed(max_speed);
|
||||
get_nav()->set_max_speed(max_speed);
|
||||
this->path_point = this->path->get_closest_point(get_target()->get_global_position());
|
||||
get_nav()->set_target_position(this->path->point_at(this->path_point));
|
||||
Vector3 const nav_target{ this->path->get_closest_point(get_target()->get_global_position(), &this->path_point) };
|
||||
get_nav()->set_target_position(nav_target);
|
||||
}
|
||||
|
||||
void WretchedPatrolState::process(double delta) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue