YUKA NavMesh example

Hi, i want to create navmesh with YUKA library but i can’t find example how to do that with list of simple meshes created with babylon, i have found example from @labris but it uses navmeshloader for gltf models and i researched YUKA docs however i don’t understand how to achieve my goal

I believe you may create planes or grounds on passable tiles then merge them into one mesh, then put it from Blob->URL into navmeshloader. Or parse it at Yuka side from arrayBuffer - Yuka | Documentation
Be aware that if there will be a lot of holes your navmesh graph may give some errors in defining its nodes.
Other way for tiled grids is to use pathfinding - npm , then use YUKA behaviors as you like.

2 Likes

What i did wrong ?

I think this is because of Yuka navmeshloader limitations.
It needs glb files with embedded buffer data, while you are exporting json.
Probably you’ll need some extra tools to convert it to the needed format.

Seems GLTF-Transform may help in this case.
Take JSON from serialized mesh as webIO.readAsJSON, then convert to Uint8 Array with webIO.writeBinary, then pass Uint8 Array to navmesh loader.

Thank you very much, now i start thinking is i really need YUKA, I have decided to use this lib for create enemy with POV, i wanted enemy was able to spot a character and start chasing, but when i faced with navMesh issue i decided get back to recast-detour and use Ray for POV imitation, how do you think was it decision right or i must use YUKA for my objective ?

It greatly depends on the specific use case. Recast is good for navigation agents but Yuka has a lot of valuable steering behaviours and Obstacle system. Need to check out, but probably the Corridor system from Yuka may help to navigate without navmesh in your case. Or shortly, you need to find the best combination of some ready-to-use scripts to make your own system. Ask more questions :slight_smile:

I am not aware about Corridor system and how it actually works, however judging by the name it may not appropriate in may case because i have big rooms and i would like to enemy be able to walk any corner of this room, i need to read more about YUKA, but there is only API documentation, as a person with no experience in game development, this documentation is difficult for me. Looks like I’ll have to read the book ))