Open Favkis opened 3 years ago
I think there may be some offset issues, check this issue:
https://github.com/MilosLukic/Godot-Navigation-Lite/issues/4
I think that the (temporary) solution is to have the navmesh e.g. your terrain placed so that the 0.0 is at the center of the map.
@MilosLukic I have everything in 0 cause I read that default godot navigation has issues if something is not at 0, so I always keep everything map related at 0.
I also tried getting offset from point that had to be returned and what I've got, I tried offesetting both/either position that is returned,position on entrance and stuff, but no luck. Also weird thing is that it doesn't seem to be XZ offset, it ALWAYS makes point on the mountain, so maybe it thinks closest path is to go as high as possible, because weirdly enough when changing Y to input/output coords, it's either always on mountain or nowhere at all (probably same pos as where it's at already)
I deleted generated collision covex and made simple box colision, and it fixed navigation
However it means for this addon to work, collision has to be single box. I added second collisionshape to staticbody's map, second large box and it breaks path_find again
Ok the problem is if any CollisionShape doesn't have translation 0 0 0, then all navigation breaks.
Now I tried to create multiple convex shapes, baked navigation and it's still broken.
Tried single convex shape, and when baking godot crashes.
Also weird thing is that when it breaks (if I use ANYTHING but box static body collision in 0 0 0, when it breaks, find_path only returns points at the points between navigation grid)
MRP if anyone needs it
https://user-images.githubusercontent.com/46406204/104125542-7a63d800-5368-11eb-85b2-c828c1ceefca.mp4
I use this to generate path:
path=nav.find_path(self.global_transform.origin,pos)["points"]
This code draws yellow lines:
I clicked somewhere right and it returns not straight line to there, but lines somewhere far left top (I used default navigation and it worked just fine. Raycast is fine cause I click on character first to select it and it selects correctly)