How check what bones AI cab see

I’m making a stealth action game and want AI to only detect the player if they can see a larger percentage of the player. I’m not sure quite how to do this, and there aren’t a lot of sources on this.

I am not so sure if that option actually exists. Maybe someone else can provide that information.

However what you could do is, depending on your Character State, change the perception radius of your enemy.

What I mean by that is for example let’s say you can crouch in your game. Whenever you’re crouched, use perception radius xyz and whenever you don’t crouch, use radius abc.
Whenever you’re hiding in a bush or something, the AI has to be closer to your player character to change the state. Things like that.

Something else you could play around with would be the focus you’re setting in your widget.

Hey @TheFuriouswc!

When the player enters your AI’s view, you can start casting some line traces (or sphere traces if you like, but that wouldn’t work so well) from the AI to the player. You can keep one as it is, add the capsule half height (or a smaller value depending on your mesh) onto another one’s end point, add & decrease the capsule radius on the x-y plane (again, you can adjust the value, also for the sideways adjustments instead of just adding values straight up, you’ll wanna subtract the AI’s location from the player’s, add the result onto the AI’s location, normalize it, have it’s cross product with the up vector (x = 0, y = 0, z = 1) or rotate it -+90 degrees around Z axis, then multiply the result with your desired value and now you can add these onto our original end point, which would be the player character’s location) and check if your desired amount of line traces hit a bone of the player character. If so, then you can execute whatever there is to happen when the AI sees the player.

Hope this helps! :innocent:

1 Like