Besides fixing the docs, It would be nice to put all the wasm deps sources together on github probably in their own repo. They used to be in the playgroundâs public folder but after the monorepo change, idk. Tbh too difficult to find stuff now that everything is aliased, at least for me but im a little dumb
If we are re-working the docs the recast setup process in general is not as described. Took me a few hours to sort it out as even the few posts about it in the forums over the last few years did not have accurate solutions. End of the day, I had to:
Include Babylonâs RecastJSPlugin
@npm -i recast-detour
import recast-detour (latest)
add the workers.js
After that the code blocks below became the startup for it. This is coming from a recently re-installed node. Hope I cut and pasted everything needed. I canât guarantee this is the âright wayâ but from what I remember this was my process and things are now working.
import { RecastJSPlugin } from "@babylonjs/core";
import * as Recast from "recast-detour";
// Class constructor...
export class navigation{
/** Holds the Navigational Plugin instance; */
public np:any;
/** Home of the JS file for the navigational webworker. Separate JS is used to create as a parellel task as to not slow down BabylonJS */
public npNavMeshWorkerURL:String = "./src/navMeshWorker.js";
constructor(){
// form your class
}
public async init(){
return new Promise(async(resolve) => {
let recast = await (Recast as any)();
this.np = new RecastJSPlugin(recast);
this.np.setWorkerURL(this.npNavMeshWorkerURL);
this.newNavMesh(); // this is where the existing docs pick up with usage
resolve(1);
});
}
}
Wish we could package recast-detour into Babylon so the process is as simple as every other part of BabylonJS to use. But understanding that its not a commonly used feature and that may bloat things.