Unfortunately, it’s not as straightforward as it should be given that a characters sight perception is very depending on which way the characters head is rotated. Seems like an obvious feature for Epic to add.
The way I did it was to create an empty actor blueprint and add the AIPerception component to that. I called it “Senses” or something like that.
Then I added the Senses as a child of my Character blueprint.
Then inside the Senses blueprint I match its world position and rotation to a bone/socket in my characters head and update this position and rotation on tick.
This works but it adds a lot of additional complexity because:
- You have to handle all the communication between the Senses actor and the Character
- The debug display for AIPerception doesn’t seem to work unless its added directly to a character. Therefore I had to handle drawing any useful debug data myself, inside of the Senses actor blueprint.
Here is the end result: