PawnSensingComponent in C++

Hi all,

I’ve just started with UE4 and C++, and I’m starting to make a stealth game. I’ve found the Pawn Sensing Component in blueprint, which seems to be a good way to implement sight and sound detection in C++. I’ve previously created a GuardController which has rudimentary movement mechanics in using a Behaviour Tree, but it is not as realistic as the pawn sensing component seems to be. Having set the component up in my GuardBot class, I have recorded Debug messages using the OnSeePawn function delegate. My question is, using a behaviour tree and services/decorators, how can I fire off a movement event so that if the bot sees me using the delegate, it moves towards me? Is this possible in pure C++?


I would recommend setting a blackboard value such as OnEnemySighted when the bot sees the player. In the behavior tree you have a moveto enemy task that is guarded by the blackboard check on the OnEmeySighted boolean.