Yuka AI Example

Hey, everyone!

Me and my brother ended up not finishing the Halloween jam submission on time, we just ended up spending a little too much time learning the APIs we were working with hahaha

But now we’ve got it pretty streamlined! Here’s a video demonstrating the Yuka AI library along with PlayCanvas written in ClojureScript that we put together yesterday:

All the models and textures were made in Blender 2.9. Yuka keeps track of its own local 3D world with nothing but a navmesh, and using a sync function the resulting Yuka quaternions and vector3s are converted to PlayCanvas quaternions and vector3s every frame.

On top of that, I wrote a couple of lines real fast to read the Yuka velocity vector’s length to determine if it should play the walk or idle animation. It’s very painless!

Now that we’ve gotten pretty fast at implementing all the libraries from scratch and doing the art in the same day, we’ll probably be taking another try at a game jam soon, so I’ll keep you guys updated!

5 Likes

Very nice! How did you build/construct the navmesh?

1 Like

Ah usually I ctrl + C my entire level from Blender 2.9 and ctrl + V it into Blender 2.79 since their clipboards are cross-compatible, and then I automatically generate the navmesh using the built in Blender game-engine, copy and paste that back over to blender 2.9 and delete any islands I don’t need, but since this tiny level is so simple, in this case I just took a flat plane, cut out the area containing the seats, and then threw a triangulate modifier on the result.

It’s also important to note that when you export a GLB with “apply modifiers” checked, the triangulate modifier is not applied, so you have to apply it manually before exporting, otherwise it won’t be a valid navmesh.

From there PlayCanvas reads from an exported visual GLB and Yuka reads from an exported navmesh GLB!

1 Like