# How to use RecastJSPlugin?

**URL:** <https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256>\
**Category:** Questions\
**Tags:** documentation\
**Created:** [January 27, 2020, 2:08am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256 "2020-01-27T02:08:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cnnamon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cnnamon/32/6594_2.png) [@Cnnamon](https://forum.babylonjs.com/u/Cnnamon)\
**Post date:** [January 27, 2020, 2:08am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/1 "2020-01-27T02:08:03Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Joseph\_DeStefano](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joseph_destefano/32/2091_2.png) [@Joseph\_DeStefano](https://forum.babylonjs.com/u/Joseph_DeStefano)\
**Post date:** [January 27, 2020, 2:19am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/2 "2020-01-27T02:19:41Z")

</div>

I asked this recently as well.

> [@Using navigation mesh extension](https://forum.babylonjs.com/t/using-navigation-mesh-extension/8031):
>
> How does one go about using the navigation mesh extension? I’m on version Babylon.js v4.1.0-beta.4 [Create Navigation Mesh - Babylon.js Documentation](https://doc.babylonjs.com/extensions/navigationmesh) Doesn’t mention what file(s) are required, and I don’t see it listed under: [GitHub - BabylonJS/Extensions: Extensions for Babylon.js](https://github.com/BabylonJS/Extensions) When I try to use it, I get an error: Uncaught ReferenceError: Recast is not defined at new RecastJSPlugin (babylon4preview.js:135414) at new World (world.js:93)

---

<div class="post-metadata">

**Author:** ![Cnnamon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cnnamon/32/6594_2.png) [@Cnnamon](https://forum.babylonjs.com/u/Cnnamon)\
**Post date:** [January 27, 2020, 2:19pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/3 "2020-01-27T14:19:34Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Joseph\_DeStefano](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joseph_destefano/32/2091_2.png) [@Joseph\_DeStefano](https://forum.babylonjs.com/u/Joseph_DeStefano)\
**Post date:** [January 27, 2020, 2:24pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/4 "2020-01-27T14:24:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 27, 2020, 5:24pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/5 "2020-01-27T17:24:57Z")

</div>

Pinging @Cedric

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 27, 2020, 5:44pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/6 "2020-01-27T17:44:58Z")

</div>

Hi @Cnnamon

Recast js plugin is available as an npm here : [recast-detour - npm](https://www.npmjs.com/package/recast-detour)

Let me know if you have troubles using it.

---

<div class="post-metadata">

**Author:** ![Cnnamon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cnnamon/32/6594_2.png) [@Cnnamon](https://forum.babylonjs.com/u/Cnnamon)\
**Post date:** [February 2, 2020, 2:38pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/7 "2020-02-02T14:38:19Z")

</div>

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](https://doc.babylonjs.com/extensions/navigationmesh#how-to-use-the-navigation-mesh)

`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 🙂 This could be included in documentation to avoid confusion

---

<div class="post-metadata">

**Author:** ![Cnnamon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cnnamon/32/6594_2.png) [@Cnnamon](https://forum.babylonjs.com/u/Cnnamon)\
**Post date:** [February 2, 2020, 6:29pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/8 "2020-02-02T18:29:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 3, 2020, 8:33am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/9 "2020-02-03T08:33:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tommox86](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tommox86](https://forum.babylonjs.com/u/tommox86)\
**Post date:** [August 9, 2020, 3:57am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/10 "2020-08-09T03:57:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tommox86](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tommox86](https://forum.babylonjs.com/u/tommox86)\
**Post date:** [August 10, 2020, 2:06am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/11 "2020-08-10T02:06:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [August 31, 2020, 12:27pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/12 "2020-08-31T12:27:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tommox86](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tommox86](https://forum.babylonjs.com/u/tommox86)\
**Post date:** [September 1, 2020, 1:03am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/13 "2020-09-01T01:03:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [November 23, 2020, 11:44pm UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/14 "2020-11-23T23:44:51Z")

</div>

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

```auto
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 ???

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 24, 2020, 1:01am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/15 "2020-11-24T01:01:36Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [November 24, 2020, 1:27am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/16 "2020-11-24T01:27:03Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 24, 2020, 1:28am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/17 "2020-11-24T01:28:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [November 24, 2020, 1:47am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/19 "2020-11-24T01:47:12Z")

</div>

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](https://github.com/MackeyK24/Babylon.js/tree/425e8c354d42854d3ddf4474fb414c5826723d21)

SCREWED UP AND CHOPPY MOVEMENT WITH 4.2.0-RC6: [GitHub - MackeyK24/Babylon.js at 412209ce0eca8edfc5bb393bc7e72c68668977ec](https://github.com/MackeyK24/Babylon.js/tree/412209ce0eca8edfc5bb393bc7e72c68668977ec)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 24, 2020, 1:51am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/20 "2020-11-24T01:51:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [November 24, 2020, 1:52am UTC](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256/21 "2020-11-24T01:52:09Z")

</div>

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

[Next page](https://forum.babylonjs.com/t/how-to-use-recastjsplugin/8256.md?page=2)
