[C++ basics] How to get rotation of an actor?

Hello!
I have really basci question, for which I need really basic answer.
Right I need to get pitch of an actor, so I can add X to it when certain conditions are met. Here is what I am using right now:

AActor::GetControlRotation.Pitch;
		Rotation += Value;

which, as you very well could Imagine, does not work. The “Rotation” on 2nd line is undefined, and AActor::GetControlRotation.Pitch must have a class type (no idea what that is :O).
Could someone guide me to the right path?

Thanks, -DoctorPC

FRotator ActorRotation = YourActorReference->GetActorRotation();

ActorRotation.Pitch += Value;

YourActorReference->SetActorRotation(ActorRotation);

If you are doing this inside the actor class you want to apply the rotation to, you can omit the “YourActorReference->” parts.

Thanks, helpfull!

I am getting arror “YourActor reference is undefined”. Should I add soemthing to the header file?

You need to get a pointer to the actor you want the rotation of, then you can assign it to YourActor.

it also worked for me. thanks bro.