Loading CSV for Track

Hello Everyone

i got a question about other ways to pass csv data to my mesh for walking a path. i used this PG as template: https://playground.babylonjs.com/#KBS9I5#81
here i want to add my own coordinated from csv.

Here is the Playground where i can successfully load the CSV with the coordinates my dude should walk, but since i can not pass the coordinates to scene.onBeforeRenderObservable.add((), i put it into it, but of course it will always load the CSV and is in the loop:

is there a way to load the csv only once and pass it to the dude? If thats working i want to add more tracks in the csv, clone the dude and give each dude a different track.

You can load the file outside of scene.onBeforeRenderObservable by doing:

var fileName = "https://dl.dropbox.com/scl/fi/nrzi9ahyhwxxo1yrimjjn/test.txt?rlkey=tj8mhywr3wd6gki6vnttzcj08";
const data = await BABYLON.Tools.LoadFileAsync(fileName, false);

Then use data to build the track array.

1 Like

Thank you!

Tried it before, probably gave up to early. lots of arrays now but working perfect.

one more question, if i see right the dude is pushed around the map while the walk is animated. iā€™m not into these meshes and skeletons yet. But is there an easy way to adopt this to some simple car mesh? i saw in the template pg (later versions) some car moving straight through the scene, but it used different parameters. with the dude i like that i can easily use y-coordinates. i couldnt find a fitting mesh in the assets library, the buggy didnt work for me.

glad for any hint

1 Like

I think all our assets are listed in this page:

1 Like