Multiple walking characters

Hi all,

It’s been a while, hope everyone is well. I’ve been busy working on the other elements of my project and just finding some time to get back and improve my city.

I was looking to add a few moving features to the city that I have and that would be to have people walking around. I have one person walking as per the code below, but I wondered how to clone and space the people all over the city? for reference my city is at theblockcity . com

I guess using a NavMesh with what @Cedric built would be great: Creating A Navigation Mesh | Babylon.js Documentation

1 Like

for various reasons can’t be share project
but check this Site
If this type of multi-structure is what you’re implementing, it might be of some help.

Here is one of examples - Yuka Game AI + Babylon.js Examples - the 1st Release - #40 by labris
Demo here - Yuka | Navmesh with Spatial Index and Tasks

2 Likes

Hi, This site doesn’t load for me

Yes, this would be perfect. I’m worried they might fall of the edge of space in my model but we’ll see haha. Just looking into the source code.

You may use much simpler setup with Yuka FollowPath steering behavior and, if you need, Wandering steering behavior.
In this case you even don’t need a navmesh.
All these examples are here - Yuka | Examples with Babylon.js , with link to Github.

1 Like

Thanks @labris I completely forgot your amazing support for yuka… and this is just awesome to have it.

1 Like

Yuka itself is based on the brilliant book - https://www.amazon.com/Programming-Example-Wordware-Developers-Library/dp/1556220782
I wonder if it would be good idea to add steering behaviors to Babylon node behaviors?
Otherwise one needs to write such by themselves, like here - Making a Simple Car | Babylon.js Documentation

Hey Labris, I’ve downloaded the sourcecode in Visual Studio. Looks very complicated to implement into my already existing model though. I think my objective is more like the one you shared earlier in the buildings but there isn’t a repo for that one.

https://yuka.babylonpress.org/examples/js/navigation/navmeshPerformance/
Source - yuka-babylonjs-examples/examples/js/navigation/navmeshPerformance at main · eldinor/yuka-babylonjs-examples · GitHub
If you change red cones to characters, it will look the same as in my ‘walking’ example.

Is there a github for that and how do you programme the paths in, on my model for example

i’m sorry to link by wrong site. i missing just add to https://
so come to this site
hope it helps

In order to program path in abovementioned Yuka example with Follow path one needs to define some Vector3 waypoints in Path array.
It shouldn’t be complicated.
It will look like

  const path = new YUKA.Path()
  path.loop = true
  path.add(new YUKA.Vector3(-4, 0, 4))
  path.add(new YUKA.Vector3(-6, 0, 0))
  path.add(new YUKA.Vector3(-4, 0, -4))

and so on.

Cheers. I’ve never got how I can easily find coordinates for a specific point on my map. I’ve used trial and error in the past.

Thanks, that looks great. Yes, it’s something I want to implement on my site so that people can walk around my city. The only trouble is, I had to severely reduce the quality to make it render at a decent FPS. Do you have a playground or something for the camera / person code?

This method is quite popular nowadays :slight_smile:

1 Like