Download

AIController w/ AIPerception: How to specify the location/rotation of the eyes?

I am currently trying myself on an AI. I have a Pawn, an AIController and to the latter I added an AIPerception component. Imagine a character where vision and movement direction do not have to coincide (an example I can think of is ArmA2, where you can turn your head independently from your body).
While I can disconnect vision and movement via Blueprint, the direction for the visual stimuli seems to be stuck to the movement direction. This might mean that I have to rethink my way of controlling the character. Or maybe I actually have to tell the AIPerception component that the character is able to move its eyes.

Any ideas how to do this? I wouldn’t be afraid to dive into C++, but I don’t know where to start with this.

I would still very much appreciate hints on this. :slight_smile:

You want to move your camera but not your hands and weapon if this was a FPS game, is that or I missing something ?

You are right. I want to move the head (i.e. the camera) without changing the movement direction. On an AI.

The AIPerception sight works fine, but I don’t know how to tie it to the head-movement instead of the rest of the body.

Sounds to me that the body is a child of the camera, so, if you rotate the camera, all his children rotate with her.

If that’s the case, you need to take away the camera, or the children.

The camera is a child of the head. But is the camera in any way relevant for an AI-controlled Pawn? If it was, turning the head should result in turning the direction of sight, too. But that does not happen.

This is what you want ?

He wants the AI character to look around so that the AIPerception component’s field of view rotates around the AI character. So yes, something like what you posted, but with AIPerception component and no actual camera or anything like that.
Not players but with AI.

Thanks for your posts! And yes, this is what I was trying to describe. Sorry if my description wasn’t clear enough.

In theory, the AI Percetion Component just calls Actor::GetActorEyesViewPoint() of its outer actor which I’ve found to be a bit limiting. If you want independent rotation you might need to do something weird like have two independent actors, where one follows the other (or just modify the source code.

(See AIPerceptionComponent.cpp in GetLocationAndDirection())

Two actors I wanted to avoid. Thanks for the hint at the source code, I will hopefully be able to modify it appropriately. :slight_smile: