title: Can't seem to get GetRelativeRotation() to work in Unreal C++
body: <p>According to the unreal documentation, GetRelativeRotation is a member variable of USceneComponent. However, when I run my code, it tells me that it's not. I have tried switching my Camera to a UCameraComponent(as it was originally before I checked the documenation) and still no luck. Any ideas? heres the code for the .cpp file:</p>
  <pre><code>#include &quot;FirstPersonCharacter.h&quot;
  
  AFirstPersonCharacter::AFirstPersonCharacter()
  {
  
      PrimaryActorTick.bCanEverTick = true;
  
      AutoPossessPlayer = EAutoReceiveInput::Player0;
  
      bUseControllerRotationYaw = false;
  
      Cam = CreateDefaultSubobject&lt;UCameraComponent&gt;(TEXT(&quot;Camera&quot;));
      Cam-&gt;AttachTo(RootComponent);
      Cam-&gt;SetRelativeLocation(FVector(0.f, 0.f, 40.f)); //places the camera 40cm above the centre of the body.
  
  }
  
  void AFirstPersonCharacter::BeginPlay()
  {
      Super::BeginPlay();
      
  }
  
  void AFirstPersonCharacter::Tick(float DeltaTime)
  {
      Super::Tick(DeltaTime);
  
  }
  
  void AFirstPersonCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
  {
      Super::SetupPlayerInputComponent(PlayerInputComponent);
  
      InputComponent-&gt;BindAxis(&quot;HorizontalMovement&quot;, this, &amp;AFirstPersonCharacter::HorizontalMove);
      InputComponent-&gt;BindAxis(&quot;VerticalMovement&quot;, this, &amp;AFirstPersonCharacter::VerticalMove);
      InputComponent-&gt;BindAxis(&quot;VerticalLook&quot;, this, &amp;AFirstPersonCharacter::VerticalRot);
      InputComponent-&gt;BindAxis(&quot;HorizontalLook&quot;, this, &amp;AFirstPersonCharacter::HorizontalRot);
  }
  
  void AFirstPersonCharacter::HorizontalMove(float value)
  {
      if (value) //make sure it doesn't constantly call on addmovementinput if theres no value to add to it
      {
          AddMovementInput(GetActorRightVector(), value); 
      }
  }
  
  void AFirstPersonCharacter::VerticalMove(float value)
  {
      if (value) //make sure it doesn't constantly call on addmovementinput if theres no value to add to it
      {
          AddMovementInput(GetActorForwardVector(), value);
      }
  }
  
  void AFirstPersonCharacter::HorizontalRot(float value)
  {
      if (value)
      {
          AddActorLocalRotation(FRotator(0, value, 0));
      }
  }
  
  void AFirstPersonCharacter::VerticalRot(float value)
  {
      if (value)
      {
          float temp = Cam-&gt;GetRelativeRotation().Pitch + value; //THIS IS WHERE THE ISSUE IS
          if (temp &lt; 65 &amp;&amp; temp &gt; -65)
          {
              Cam-&gt;AddLocalRotation(FRotator(value, 0, 0));
          }
  }
  </code></pre>
  <p>and the code for the header file:</p>
  <pre><code>// Fill out your copyright notice in the Description page of Project Settings.
  
  #pragma once
  
  #include &quot;CoreMinimal.h&quot;
  #include &quot;GameFramework/Character.h&quot;
  #include &quot;Components/InputComponent.h&quot;
  #include &quot;Components/SceneComponent.h&quot;
  #include &quot;Camera/CameraComponent.h&quot;
  #include &quot;FirstPersonCharacter.generated.h&quot;
  
  UCLASS()
  class MOMENTUMPROJECTMAIN_API AFirstPersonCharacter : public ACharacter
  {
      GENERATED_BODY()
  
  public:
      // Sets default values for this character's properties
      AFirstPersonCharacter();
  
  protected:
      // Called when the game starts or when spawned
      virtual void BeginPlay() override;
  
  public: 
      // Called every frame
      virtual void Tick(float DeltaTime) override;
  
      // Called to bind functionality to input
      virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
      
  
  private:
      void HorizontalMove(float value);
      void VerticalMove(float value);
      void HorizontalRot(float value);
      void VerticalRot(float value);
  
      //allows me to edit in the editor, without going into source code.
      UPROPERTY(EditAnywhere, Category = &quot;Camera&quot;)
          UCameraComponent* Cam;
          
  };
  </code></pre>
  <p>thanks.</p>