0 votes

Hello
I've been trying for 2 days to understand the 3D Navigation system and the getsimplepath 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.

in Engine by (19 points)
edited by

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...

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.