Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bluecatgames |
Hi Guys!
I need a help with the new pathfinding system implemented in godot 3.5.1 , it seems not creating a path who avoid static bodies, look the video above:
Path Problem error video
When the enemy needs to return the initial position, the path is not drawed and the enemy stucks in the wall.
It seems are drawing a direct line path and not one who avoid the wall.
Here is the code:
func return_Initial_pos(delta):
navigation_agent.set_target_location(initial_pos)
if navigation_agent.is_navigation_finished():
return_finished = true
return
destination = global_translation.direction_to(navigation_agent.get_final_location())
destination.y = 0
var desired_velocity = destination * 20
var steering = (desired_velocity - velocity) * delta * 4.0
velocity += steering
velocity = move_and_slide(velocity)
var target_position = navigation_agent.get_target_location()
target_position.y = self.transform.origin.y
look_at(target_position, Vector3.UP)
Here the main scene tree:
MainSceneTree
Here the enemy tree:
EnemySceneTree