I have a character that is 2 meters tall, but is able to jump up to 10 meters. During gameplay I raycast to see if a jump is needed. However, using Recast graph if I set Walkable climb to 10 I get the error “Walkable climb should be less than walkable height. Clamping to 2”
How do I fix this?
‘Walkable Climb’ is perhaps not the best name for that setting (in fact it is already changed in my dev version to ‘Step Height’ which is more descriptive). It describes the how high ledges can be before the character can no longer step up on them. If the step height would be greater than the character height there might be cases where the navmesh could not be a single surface since it might be possible to walk under an obstacle and step up on it and the navmesh cannot represent that.
For jumping you need links, take a look at one of the recast graph example scenes which shows a character climbing and jumping (it’s a very simple AI, but it shows the main idea at least).
Hey there. This was the first thing to trip me up, but this explanation makes total sense.
But I’m just wondering, then - what should be my approach when I have a step up height for my character that is higher than when they are crouching? Should I make a different mesh for crouching reach-abilities or something? Or should I just do my own pass of off-mesh-link style things to tell the AI that they still can get up over ledges within a certain range, so long as those aren’t blocked by some sort of geo raycast?
You will have to use off mesh links for that.
Hey. I’m reading and digesting the code base today. Questions popped up.
Is there a good way to add in a post- RecastGraph build, so that I could potentially automatically detect places to add off mesh links (I assume I want to use something derived from NavLink2 so that they’re included use RichPath).
Also… this one is hard to explain, but bear with…
NavLinks are just lines between graph nodes… So when an AI encouters it, it only picks one spot to start from, and one to end… the link has no “width”. (Am I wrong about this?)
Is there any way to give a link “width”, almost as if it’s an extra face constructed between nav mesh edges? [Edit: Oh! NavLink3’s are the ones that connect nodes as if they share an edge!!! OOOOOHHHHHH BABY!~][Edit2: Sadly, RichPathPart only implements NodeLink2, not 3. So… I will have to write something that does]
A good example would be a long ledge above the ground which can be climbed/dropped down from, from anywhere along the ledge.
I know I can always put a bunch of links along such a ledge, but this feels less true than a mesh patch. I believe Killzone 3 did this.
I’m not pretending it’d be easy, but, would there be a way to adjust the RecastGraph’s mesh right after it’s computed, so that I could identify edges, do some traces to check for reachability, and add in a nav-patch?
I guess I should start with this page, but extend from a RecastGraph/RecastGraphEditor and /waves hands/ somehow do a post process on the generated mesh?
It is not currently possible to use wide links, but several point links are a good approximation. Yeah the original Recast project does have some support for wide links (this is the same implementation that Unity uses).
So if you want to process the graph right after it is done scanning you can do it in two ways. Either you can register for the OnPostScan callback or you can subclass the GraphModifier class and override the OnPostScan method.
You cannot directly post process the mesh using this, for that you would have to override the BuildTileMesh method in the recast graph (which is not virtual so you would have to change that), but you can add connections between nodes or create some node link components (probably easier).