godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.65k stars 1.58k forks source link

Use NavigationAgent3D in 3d/navigation demo #975

Closed idbrii closed 10 months ago

idbrii commented 10 months ago

This is a port of #806 to Godot 4.

I put type hints in a separate commit, but I can squash with other code changes if you prefer.

Add NavigationAgent3D to robot and add a script on the robot to use it.

Remove DrawPath and replace with dynamically created Line3D that makes it easier for users to copy to their projects (just copy the code instead of copying multiple parts out of a scene).

There are several auto applied changes to the scene that I'm not sure about. I'm saving in Godot v4.1.1.stable.official [bd6af8e0e] and it appears that it no longer uses uids?

While I made these changes on Godot 4.1, I did not commit the changes to project.godot. It gets reordered and sets config/features=PackedStringArray("4.1"). I'm not sure if demos should be on the latest stable?

I ran into an update_polygons error message, but the only way I could find to fix was to revert the nav mesh cell size (I don't know where to set the nav map cell size or why it doesn't match). I don't see a difference in behaviour.

Lighting

I also changed the lighting to actually illuminate the ground:

Before before

After after

idbrii commented 10 months ago

Folded those review changes into the corresponding commits.

Calinou commented 10 months ago

While I made these changes on Godot 4.1, I did not commit the changes to project.godot. It gets reordered and sets config/features=PackedStringArray("4.1"). I'm not sure if demos should be on the latest stable?

It's fine to commit that part. We want demos on the master branch to run on Godot 4.1.x as well as 4.2 betas, but keeping support for 4.0.x isn't required.