AI Perception SuccessfullySensed issues
I'm currently using the AI Perception system for my AI to detect characters and relevant actors in the world (grenades, for example). This works perfectly fine for all characters, however when it comes to detecting other actors they will initially successfully sense the actor in the first perception update and then any frame after that fail to successfully sense them.
Here is a webm to show off the perception debugger and logs I'm getting: http://puu.sh/raOAv/6ab6250e3c.webm
In the webm sample I've posted here, the player character that it successfully detects derives from the character class, and therefore has the default pawn class sensory stimuli.
The grenades I throw (basic sphere meshes) are actors set up in c++ with a UAIPerceptionStimuliSourceComponent for perception. I have also tested these with a BP AI Perception Stimuli Source for sight and I get the same issue of detecting them initially and then just failing the sense, as indicated in the logs.
The ragdoll bodies I spawn in are a BP class derived from APawn, with the same stimuli as the character classes have, with a single static mesh. These also suffer from the same problem as the grenades.
Outside of the webm I have tested it in just about every number of combinations of parent classes and components I can think of, with both BP and C++ classes. They've all had the same problem. Am I doing something wrong here? Why is it detecting the player and other AI properly but never other actors?
Here's the code used for the AI controller's perception updates:
For the ragdoll's what happens is your AI tries to look at the capsule components position but the ragdoll is on the floor, so the linetrace never 'sees' anything, to fix this you can implement an "IAISightTargetInterface" on your AI-character and override the CanBeSeenFrom() function to make sure he actually looks at the mesh's position. This way Unreal will not use the default trace which is only a linetrace to the actors location.
Don't forget to include: "Perception/AISightTargetInterface.h".
Hope this helps,
answered Sep 16 '16 at 08:03 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here