How to instantiate PathCursor

Hello everybody,

I’m a IT student and have been tasked to create a game using BabylonJs.

In order to create a Tower Defense, I wanted to make enemies follow a predetermined path.

I found Path2 in the documentation and thought “Hey, that sound exactly like what I want”, then I found PathCursor and overjoyed, I started experimenting.

You can find the playground here, I tried to minimize the code to the error only…

My attempts was quickly cut short…
I don’t even know if I’m using these tools correctly, i tried to build my path using addlineto successively (PG line 34).

Then I wanted to instantiate my PathCursor and use it to move my meshes, but when calling (PG line 12):

let cursor = new BABYLON.PathCursor(path);

The error returned is the following:

Uncaught TypeError: BABYLON.PathCursor is not a constructor

And I don’t understand why !

Do you perhaps have an idea why I get this error ? What did I do wrong :c

Pinging @jerome or @johnk as I believe one of them is the author of the PathCursor

Looks like index.ts is missing the pathCursor and thus the class isn’t exported.

This will fix it:
Add missing pathCursor by bghgary · Pull Request #9762 · BabylonJS/Babylon.js (


not my baby :wink: