Walking on walls


#1

Hi

I’m working on a project that requires an AI unit to be able to walk along walls as well as the floor. Imagine a spider walking along a floor and then walking up, down and along a wall.

I’ve seen in another post from some time ago the suggestion that one might be able to use a navmesh for this. My code automatically generates walls as a mesh, so on the face of it this could work for me if I assign via script the wall mesh to the navmesh “source mesh” property, however before I put down a chunk of change on the A* pro package I’d like to understand if anyone has direct experience of this?

If anyone has any further advice such as potential issues, better/alternative approaches, and the like I’d be happy to hear them.

Cheers


#2

Hi

This is not a particularly easy problem to solve. I must say that I myself haven’t tried anything like it so far so my advice will be a bit hand-wavy.
You would have to use a custom navmesh as no other graph could generate that automatically. The important and more difficult part however is that the mesh needs to be well connected. You cannot just have boxes for the walls that are separate from the floor, they need to share vertices and edges with the floor to work properly.

In 4.x the funnel modifier should at least be able to handle the curved surfaces decently if you enable both the ‘unwrap’ and the ‘split at every portal’ options.

See https://arongranberg.com/astar/docs/class_pathfinding_1_1_funnel_modifier.php#ab7b6f6d38f721fff79669e56c74809ff

Consider your game’s needs carefully, perhaps you don’t need much pathfinding and can instead use a simple technique of “move in the direction of the target”. This way you could instead focus on building a spider that will adapt to whatever physics surface it meets, which might be easier. This will likely be more flexible, however it will of course not be able to find its way around anything more complicated than very simple obstacles.


#3

Hi @aron_granberg

Thanks for the reply, I apparently got distracted with work related stuff and here I am nearly a year later still thinking about this! I’ve actually just purchased Pro and was about to ask the very same question I already asked, until I realised I’d been there, done that.

I recently found this YT video purporting to do pretty much what I have in mind using marching cubes (including deformation and updating of the navmesh) - https://www.youtube.com/watch?v=-6wY2t5etkE

The author states “For pathfinding it’s just standard A*, using meshes vertices and triangles for data. The scalar field can also be used as data. I spent quite a lot of time to make it work together.”. He doesn’t state that he’s using your package but I wondered if what he says rings a bell with you as to how I might be able to use your package to achieve a similar effect?

Thanks again, and I will (probably) reply quicker next time…


#4

Okay. Well, I can’t speak for the marching cubes algorithm, but once you have the mesh you could use that as the input to a navmesh graph. You will have to make sure to set ‘normals’ to ‘original’ in the navmesh graph settings though, otherwise it will not work well.


#5

Hi @aron_granberg !
Thank you for your great job!
But how about agent, what should I do for reorient to wall, I did everything that you discuss here.
but bot just stuck here.


#6

Could you give this scene?
I have a pro version too


#7

Hi

I think that scene should be included in the spherical beta available here: https://www.arongranberg.com/astar/download (click on ‘Show older versions’, you will find it in the list).


#8

The scene is there but the dumbell looking mesh is not in the project, so you’d need to add your own mesh. That’s why I included an icosphere in the updated version I emailed you. There has been a lot of interest in this, you may want to have the package I emailed you available for download.


#9

The sphere example is kinda helpful, in that if I add a sphere and a little script to assign it’s sharedMesh to the navmesh component, I can easily get the player object moving around the sphere.

There’s a broken link in the AIArbitrarySurface script though, pointing here: http://arongranberg.com/astar/docs/class_pathfinding_1_1_examples_1_1_a_i_arbitrary_surface.php

so it’s a little difficult to understand just exactly what this script is doing. This is amplified if I use some other shape for testing such as a cube - the pathfinding doesn’t work at all - and a little documentation here would be helpful. As it is, “arbitrary” in this instance appears to be a bit misleading; perhaps it should be called AISphereSurface?


#10

Hi

I have uploaded a new spherical beta version now. See this thread for more info: Navmesh on a spherical planet