AI Perception - Sight and Character Rotation Inconsistency

I ran into a problem with AI Perception sight. When a character with AI Perception is performing a MoveTo or RotateTowardBBEntry, the AI Perception sight cone instantly rotates toward the MoveTo (or RotateTowardBBEntry) location, instead of rotating with the character.

Link to video, watch closely as the sight cone snaps behind the character, and then the character turns toward the move to location: Google Drive: Sign-in

This means that the player could be standing behind the character, and on the first frame of the character rotating, be seen by the character. This may seem subtle, but during gameplay is extremely obvious, and seems like the character saw the player when he shouldn’t have.

Is there a work around for this? Is this a code bug?

I had the same problem in 4.10.4. After much searching around I’ve bumped into a simple solution. What I did to fix this issue was:

Controller:

  1. Make sure your Controller is attached to the pawn (under Controller|Transform select ‘Attach to Pawn’)

Pawn:

  1. Uncheck ‘Use Controller Rotation Yaw’

  2. Set your rotation rate to whatever you want

  3. Check ‘Use Controller Desired Rotation’ (you may have to unhide additional options under Character Movement)

  4. Set up your Event Graph to set the Controller’s ‘Control rotation’ as Pawn’s ‘Actor rotation’. See attached image:

Hope it helps!

1 Like

Yup, this works!

I had seen steps 1, 2, and 3 under Pawn in another answer thread, and had already done those, but didn’t know step 1 under Controller and step 4 were necessary.

Thank you so much, I really appreciate it!

This almost helped me. After doing this, my character’s AIController rotation is being aligned to the character’s one only when he stops the movement. But while walking, it’s rotation is aligned to direction of movement - as before. Any ideas why?

I have the same problem, maybe it’s a bug of the last versions.

AIPerceptionSight uses GetViewRotation() and GetPawnViewLocation() from Pawn.h to determine the sight location and rotation. Override these two functions and you are good to go.

I found a solution for this problem using only blueprints. You have to check “use desired controller rotation” in the character, and uncheck “orient rotation from movement”. Then you have ti uses Set focus and set focalpoint to rotate the controller and so the character.

1 Like

Did you ever find the solution to this? I’m having the same issue where my AIController rotation on follows my Character once it’s finished moving to it’s destination :frowning:

Thanks a lot !