So I’m kinda tired of my custom pathfinder exploding all the time so I decided to go ahead and try this once again: spawning nav meshes on the fly
so far it… kinda works :o
here’s how it goes so far:
- made a class DynamicPylonSpawnable extends DynamicPylon with bStatic=false and bNoDelete=false
- placed on in my level with a specific size, built the paths. this is what I’ll use as a template
- in code I find the DynamicPylonSpawnable in the level, and use it as Template to Spawn a new one
- after spawning it I call RebuildDynamicEdges() in it
- hope it works. otherwise do it again
see it in action:
when the enemy sees me he just turns around like crazy as he can’t reach me (no navmesh path to go).
after spawning a navmesh box (which I show with ‘show paths’) he’s able to find a path towards me
it even seems to connect with other (existing or newly spawned) navmeshes.
but it doesn’t always work. sometimes I spawn it and it doesn’t seem to update it. also if I spawn it next to an existing navmesh that is sitting at a different height, it will skew it to connect it (probably doesnt have enough polygons to ‘build’ a ramp)