Character is too big to navigate through door way, but still tries.

Hi, I’m trying to create AI for my game using behavior trees.

Right now the AI just walks around randomly.

I have an AI task that find a random location with GetRandomPointInNavigableRadius (GetRandomReachablePointInRadius gives me the same results, what is the difference between the two?), then moves there using the basic “Move To” task.
This works great when the new location is in the same room.
But sometime to reach the new random location, the move to task will create a path that doesn’t seem to take into account the size of my AI character (its capsule). Sometime the AI wants to go right through a wall, under a doorway or an archway that is too small or between two objects that are too close to each other. The AI will get stuck after a few seconds and the Move To fails.
I understand why the Move To fails, the path is blocked. But not why the GetRandomPoint is able to return an impossible location. I use the boolean “Return value” output parameter to validate the new location and I try to find a new one if it failed. I haven’t set anything to the “Nav Data” and “Filter Class” pins, should I put something in there? This node only finds a location on the navmesh and does not validate if it’s actually reachable by my character. Should I then validate if a path exists? Will “Get Navigation System” -> “Find Path to Location Synchronously” and check if the output path “Is Valid”? But then the “Move To” won’t use this path, it will probably recalculate a new one, and this one might fail.

The capsule component is big enough to surround the whole mesh. I’ve also tried to manually set the “Nav Agent Radius/Height” and untick the “Update Nav Agent with Owners Collision” for the CharacterMovementComponent with no result.

Here it’s trying to go through the wall.

Thank you for any help.

I have managed to fix my problem, but I’m not sure if it’s the right way.

I added a nav agent in the project setting > Navigation System. The 1st one with default values. The 2nd one with the size of the capsule of my big AI monster.

Then I enabled both agents on the nav mesh bounds volume.

There are now 2 RecastNavMesh in my World Outliner, one for each agent.

The default one for human sized AI agent. Select the corresponding RecastNavMesh and toggle the “Enable Drawing” property.

The “Big Agent” recast nav mesh for larger AI agent. Select the corresponding RecastNavMesh and toggle the “Enable Drawing” property.

The character some how magically select which kind of agent it should be.

For fun I scaled the troll actor so it would be small enough to go through the doorway and it worked! Then in the level blueprint I slowly scaled it back up with a timeline to see what would happen. At 1st it worked, but then it got physically too big to go through the doorway and it still tried to go on the other side => it’s stuck on the “Default” agent, and didn’t update when it got big enough. There might be a property or a function to call somewhere, if someone knows about it, that would be nice! But I don’t think I’ll dynamically scale AI characters during their life span in my game, so it’s not a problem.

i would like to hear if that is actually how it is supposed to be done from an official/experienced dev bump

Me too :cool:

What do you mean, you’ve been given the perfect answer, with pictures!

It’s rare to get a response from a dev, take what you can get…