RealDocs

APawn::ReachedDesiredRotation

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtual

Description

Returns true if the pawn's current yaw is within AllowedYawError degrees of the controller's desired rotation yaw. Used by AI controllers to determine when a rotation move is complete.

Caveats & Gotchas

  • Only compares yaw, not pitch or roll. Pawns that need to match full 3D orientation must extend or replace this check.
  • AllowedYawError is a plain float member (not a UPROPERTY) — it can only be set from C++, not Blueprint or the editor. Its default value is 10 degrees.
  • Returns true if the pawn has no controller, which can lead to premature completion of rotation-based AI tasks when a pawn loses possession mid-move.

Signature

virtual bool ReachedDesiredRotation()

Return Type

bool

Example

Wait for rotation before firing in a custom AI task C++
void UMyBTTask_AimAndFire::TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
	APawn* Pawn = OwnerComp.GetAIOwner()->GetPawn();
	if (Pawn && Pawn->ReachedDesiredRotation())
	{
		Fire(Pawn);
		FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.