How to use RecastJSPlugin?

Hello, I read the documentation for RecastJSPlugin, but babylonjs package does not include it by default. What package I need to install to use it?

edit: Property ‘RecastJSPlugin’ does not exist on type ‘typeof BABYLON’.ts(2339)

I asked this recently as well.

I read your question but that’s not all, I am using typescript and Plugin types are not in d.ts file for some reason…

Oh - not sure then. I don’t mess with typescript much/at all.

Pinging @Cedric

Hi @Cnnamon

Recast js plugin is available as an npm here : recast-detour - npm

Let me know if you have troubles using it.

Thank you for help @Cedric, but I have one more question

How can I get typings for RecastJSPlugin? I am trying to use this example from documentation Create Navigation Mesh - Babylon.js Documentation

let navigationPlugin = new BABYLON.RecastJSPlugin();

Property ‘RecastJSPlugin’ does not exist on type ‘typeof BABYLON’.ts(2339)

Edit: I found in other thread that navigation is available from 4.1.0-alpha.9 version :slight_smile: This could be included in documentation to avoid confusion

@Cedric do you know if its possible to store generated navmesh in browser so it would not need to be recalculated every time?

It’s on my todo list. I hope to make it available in the coming months.

1 Like

hey , how did you get this to work? i downloaded the demo direct from the playground and get this error. using the latest version of babylonjs

hey cedric, how do i get recast-detour to work. npm install recast-detour doesnt work, says it needs three dependencies?

Can you copy/paste here the log/error you get?

its all good. i rebuilt the nodejs wrappers and compiled the c++ libraries.

1 Like

Yo @Cedric … Hey bro i am having some issues with recast gotoAgent and updating the the agent mesh position to the recast agent position.

Up until version 4.2.0 RC5 the movement was real smooth by me just updating the mesh position using something like this

mesh.position = BABYLON.ICrowd.getAgentPosition(agentIndex)

But now using Version 5.0.0 Alpha 0 … That same exact code now produces CHOPPY movement. If i simply copy babylon.min.js version 4.2.0 - RC5 over top the script folder and refresh browser… It is nice and smooth again.

I dont understand what could have changed in babylon.js that would cuase the movement to be choppy like that.

Do you have any example show the RIGHT way to update the a mesh to the crowd agent position on every frame ???

@Cedric is pretty busy at the moment and can have a bit of delay to handle it, I am wondering if you could in the meantime provide a repro and check if RC6 was the same ???

I hope we did not break anything in core here.

FYI… the Final Release of 4.2.0 has the issues as well… So its between RC5 and the Final Release where things went wrong

How would i go back and get a version 4.2.0 RC6 ?

Yup, the idea would be to narrow down the culprit and with a bit of luck… a lot I could take a stab at it before cedric is back

Version 4.2.0-RC5 work perfect… Smooth movement using code i have been using since we started with RecastJSPlugin.

WORKS GREAT: GitHub - MackeyK24/Babylon.js at 425e8c354d42854d3ddf4474fb414c5826723d21

SCREWED UP AND CHOPPY MOVEMENT WITH 4.2.0-RC6: GitHub - MackeyK24/Babylon.js at 412209ce0eca8edfc5bb393bc7e72c68668977ec

Thanks a ton !!! I ll check if I can spot smthg !!! and worse case, it might help @Cedric

Thanks you very much, for right now i have to LOCK into 4.2.0-RC5 until that is fixed