AI sight perception rotate instantly and not smoothly

Hello,
I have a weird behavior with my perception sight, when the character want to turn, the sight get teleported to the new rotation instead going with the character mesh that goes smootly.
I use the move to from the behavior tree and even with custom move to node,
I also tried with an empty character and with differents rotation parameter and speed but nothing so far.
Did i miss something ? it’s a 5.5 bug or only me ?

Solutions to Your Problem

  1. Smooth Perception Rotation:
  • The most important step is to smooth the perception rotation to match the character’s movement.
  • Instead of directly setting the perception rotation to the new target’s direction, you need to interpolate between the current and target rotations.
  • Implement Rotation Interpolation:
  • In your AI controller or behavior tree, when a new target is detected, store the target’s location.
  • In the AI’s tick function, calculate the desired rotation to face the target.
  • Use’’ or’’ to smoothly interpolate the perception rotation towards the desired rotation.

Example Code (Conceptual):**

`C++// In your AI Controller or Behavior Tree Tick
void MyAIController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

if (TargetActor)
{
    FVector TargetLocation = TargetActor->GetActorLocation();
    FVector SelfLocation = GetPawn()->GetActorLocation();
    FVector DirectionToTarget = TargetLocation - SelfLocation;
    FRotator TargetRotation = DirectionToTarget.Rotation();

    // Smoothly interpolate the rotation
    FRotator CurrentRotation = GetControlRotation();

FRotator SmoothedRotation = FMath::RInterpTo(CurrentRotation, TargetRotation, DeltaTime, RotationSpeed); // RotationSpeed is a float that controls the speed of the rotation.

    SetControlRotation(SmoothedRotation);
}

}`

  1. Adjust Perception Component Settings:
  • Review the settings of your AI perception component.
  • Ensure that the “peripheral vision angle” and “sight radius” are appropriate.
  • If available, experiment with any smoothing or filtering options.
  • Perception update frequency:
  • Lowering the frequency of the perception update can help smooth out the visual change.
  1. Synchronize perception with character rotation:
  • If possible, try to synchronize the perception updates with the character’s rotation updates.
  • For example, you could trigger a perception update after the character has completed a certain portion of its rotation.
  • Control Rotation:
  • Ensure that your AI controller is properly setting the control rotation of the pawn. The perception component often uses the control rotation to determine the sight direction.
  1. Behavior Tree Considerations:
  • If using a behavior tree, ensure that the tasks responsible for movement and perception are properly coordinated.
  • Avoid tasks that abruptly change the AI’s rotation without allowing for smooth transitions.

Debugging Tips

  • Visualize Perception:
  • Use the AI debugging tools in Unreal Engine to visualize the AI’s perception. This can help you identify any issues with the perception component.
  • Print Debug Information:
  • Print the current and target rotations to the screen or log to track the values.
  • Step-by-Step Debugging:
  • Use the debugger to step through your AI code and examine the values of relevant variables.

By implementing rotation interpolation and carefully adjusting your perception settings, you can achieve a smooth and natural-looking AI sight perception.

Thanks for you message but this not very helpfull, more importantly i want a human response and not a chatgpt.(even the detector make 80% AI score)