I spent WAY to long getting leg ground detection working for the patrol bots:

It still isn’t that great but it’s probably as good as I wanted it to be. The big thing is that I can put the bots on ramps and they look kinda right:

The basic idea too complicated: essentially you draw a line from the tip of the leg downward, then try to move the tip of the leg into that position. However, directly moving the leg ends up being weird because the rest of the leg doesn’t move along with it. To solve this you use some IK! From the game perspective this is essentially the process of taking a target and working how the limb will get there, rather than attempting to move the limb to the target.

In unreal there’s a thing called “IK rigs” which do a bunch of the work for you but I had NO idea how to properly implement these until I went through it once. Now I think I have a “handle” but there’s some witchcraft in the background that I have no idea why its working. But anyways here’s the trace logic:

Generally this fires from a bunch of sockets I put in the mesh, then the feet find their way to meet up with the end of those traces.

The thin red lines are the traces and red square are the “goals” that I want to move the legs to.

Now I just gotta give them some interesting things to walk on…