Hey everyone,
I want to generate hundreds of vehicles that follow a path (or paths) but I’m not sure what the optimal method would be. I bought a path follow plugin that works great but I have to add all the vehicles manually, and that’s just too slow considering the number of vehicles I need. I also tried a flock/boids system, but that came with its share of problems.
How would you go about generating a large number of objects (from a list/pool of meshes) along a spline?
Thanks!
spawn vehicles at runtime with some logic - over time, using an object pool, etc.
as far as following splines, its very straightforward.
you need a system to find the nearest spline.
Look into optimal search patterns to find the math to perform the best kind of check. I think spiraling a sphere around performs best, but this may no longer be accurate.
onve the spline is found you can probably use the ai move to or a similar command to get the car onto the spline.
after which the spline following is literally just copying the spline instructions to the object location over time.
Add a front and back collision detection system and you can build up your AI to react naturally by slowing down or moving away/avoiding or even causing crashes…