Keep AI from walking over objects

OK.

I have a Pig. It has an AI blueprint. I use NavMeshBoundsVolume to allow it to move in a desired region. If I press ‘p’ I can see the movement area and I am fine with the reults. I then drop a fence around the pig. The green movement area seems to recognize that the pig should not move into the fence area; however, it just walks over the fence?!?!?

I set “Can Character Step Up On” to ‘No’ for the NavMesh, the fence mesh and the pig but the pig just keeps walking over the fence.

How can I fix this???

The NavMesh:

The naughty pig:

1 Like

I’m sorry, idk the solution but this pig deserves a bump! :joy:

Scale down its character capsule and decrease its step height in character movement’s settings.
Btw, can you show us a video with this problem?

:slight_smile: When this happens I definitely have a craving for bacon…

See the attached video…

1 Like

Couple of things…

  • I am checking the collision of the character’s weapon with the pigs capsule component. Is this the best way to register a weapon “hit” with a melee weapon?

  • The “MaxStepHeight” is default set to 45. Seems reasonable???

  • I change the “Walkable Floor Angle” from 44.765083 (The default???) to 20 and that seems to stop the pig’s super powers. Looks like I can change this on the game instance of the pig or in the pig Ai blueprint. What would you recommend? I would think 44.765083 is a little steep of a walking angle for Ai movement of a pig…

1 Like

LOL

In that video, it kinds looks like the pig is pathing through the entrance to the pigsty.

At the top left of the viewport where it says “Perspective / Lit / Show” try pressing Show, and choosing Collisions to see if there is anything else with collisions on or under the ground, or anything nearby with extra-big collisions causing the pig to go up when it walks through the entrance.

As for your other questions, not sure on the first two, but on the third one it’s probably better to set it in the Pig AI blueprint, so that it applies to all pigs you make.

Thanks for the tip! Never done that before; however, I can see now how this will be useful.

Below is a screenshot with collisions showing… …I don’t see a problem/issue… …yes???

Looks like there is a bump at the entrance. This is a static mesh that is not visible; however, it looks like the collision box is still enabled or showing or visible. Maybe for this it should be collapsed???

Your comments found an issue!

A cut-and-paste error!

Thanks!

1 Like

I’ve completely forgotten about collision view, yes, this pig is definitely walking over some invisible collisional shape.

OK. I am going to claim this is solved in that I have moved on. In addition, I claim that my solution is just that… …“a” solution and not “the” solution.

What I did…

  • I, essentially, changed the “Character Movement: Walking”->“Walkable Floor Angle” from 44.765083 to 20 on the pig Ai blueprint such that it affects all pig instances. This is found under the blueprint “Components”->“Character Movement” portion.

I did have another Ai that was doing a similar thing and I had to change the “Walkable Floor Angle” to 10 to stop it from climbing objects. I did that on their instances and not in their blueprint.

Thank you everyone for helping!