RealDocs

UKismetStringLibrary::Conv_StringToRotator

function Engine Blueprint Since unknown
#include "Kismet/KismetStringLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Parses a string in the 'P= Y= R=' format produced by rotator-to-string conversion back into an FRotator, reporting whether parsing succeeded via OutIsValid.

Caveats & Gotchas

  • Uses FRotator::InitFromString, which parses Pitch, Yaw and Roll independently, so a string missing one axis can still report partial success rather than a clean failure.
  • OutConvertedRotator isn't reset to zero on failure, so check OutIsValid before applying the result to an actor's rotation.

Signature

static void Conv_StringToRotator(const FString& InString, FRotator& OutConvertedRotator, bool& OutIsValid)

Parameters

Name Type Description Default
InString const FString& The string to parse, expected in the 'P= Y= R=' format.
OutConvertedRotator FRotator& The parsed rotator value; only meaningful when OutIsValid is true.
OutIsValid bool& True if InString was successfully parsed into a rotator.

Return Type

void

Example

Restore a saved rotation from a string C++
FString RotText = TEXT("P=0.000000 Y=90.000000 R=0.000000");
FRotator SavedRotation;
bool bIsValid = false;
UKismetStringLibrary::Conv_StringToRotator(RotText, SavedRotation, bIsValid);
if (bIsValid)
{
	SetActorRotation(SavedRotation);
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.