get_simple_path function (begin, end) in 3D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dzandaa

Hello
I’ve been trying for 2 days to understand the 3D Navigation system and the get_simple_path function (begin, end)

My Scene:

Spatial
–>KinematicBody1
–>KinematicBody2 # Script 1
---->Navigation # Script 2
------> NavigationMeshInstance
-------->Gridmap # 3D tiles

The Gridmap is made up of tiles:

MeshInstance
–>StaticBody
---->CollisionShape
–>NavigationMeshInstance

Done Bake NavMesh on NavigationMeshInstance and I see the Navigation polygon

Part of Script 1:


extends KinematicBody        
 onready var Play1= get_node("../KinematicBody1")
 onready var Nav = get_node("../Navigation")
                
var path = []
        
func _physics_process(delta):
 if(Input.is_action_just_pressed("Attack")):
  var begin =  Nav.get_closest_point(self.get_translation())
  var end = Nav.get_closest_point(Play1.get_translation())
  path = Nav.GetPath(begin, end) 		
  print(path.size())

Part of Script 2:


 extends Navigation
    
 var path = []
    
 func GetPath(Begin, End):
  var p = get_simple_path(Begin, End, true);
  path = Array(p) 
  path.invert()
  return path 

My problem: the path.size() is always zero

But the 2 KinematicBody are at different positions.

I’m almost ready to give up using Godot.
I think it’s a great “Game Engine” but with pretty no documentation, just a list of commands.

Can someone help me?

Thank you very much.

Hi again,

Found the solution by myself, and it was easy:
After “Bake NavMesh” The Gridmap must be moved out of the Navigation object!!!
Or there are interference’s…

Dzandaa | 2020-05-12 18:25