Shooter Game - Toggle Third Person problems


I recently found this tutorial: Shooter Game - Toggle Third Person

But, It appeared some compile errors at the end of the tutorial, when adding the new camera part to the ShooterCharacter constructor: (I’m using version 4.10)

ThirdPersonCameraArm = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("ThirdPersonCameraArm"));
ThirdPersonCameraArm->TargetOffset = FVector(0.f, 0.f, 0.f);
ThirdPersonCameraArm->SetRelativeLocation(FVector(-40.f, 0.f, 160.f));
ThirdPersonCameraArm->SetRelativeRotation(FRotator(-10.f, 0.f, 0.f));
ThirdPersonCameraArm->AttachTo(GetMesh()); // attach it to the third person mesh
ThirdPersonCameraArm->TargetArmLength = 200.f;
ThirdPersonCameraArm->bEnableCameraLag = false;
ThirdPersonCameraArm->bEnableCameraRotationLag = false;
ThirdPersonCameraArm->bUsePawnControlRotation= true; // let the controller handle the view rotation
ThirdPersonCameraArm->bInheritYaw = true;
ThirdPersonCameraArm->bInheritPitch = true;
ThirdPersonCameraArm->bInheritRoll = false;
ThirdPersonCamera = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("ThirdPersonCamera"));
ThirdPersonCamera->AttachTo(ThirdPersonCameraArm, USpringArmComponent::SocketName);
ThirdPersonCamera->bUsePawnControlRotation= false; // the arm is already doing the rotation
ThirdPersonCamera->FieldOfView = 90.f;

My errors:

  • ‘Getmesh’ identifier not found
  • identifier ‘GetMesh’ is undefined

I have tried:

  • GetMesh()
  • GetPawnMesh()
  • PawnMesh3p

Any solution to this? I guess it is something simple :slight_smile:


Try using GetCharacterMesh() - GetMesh() is just an accessor for the third person mesh, syntax may have changed.

Thanks, will test that after work!

Nope, didn’t work. :frowning:


  • C3861: ‘GetCharacterMesh’ identifier not found
  • identifier ‘GetCharacterMesh’ is undefined

EDIT: I got it compiled when I used Mesh3P, but it doesn’t seem to work.

The game are still using the old 1P Camera and not the new one.

How can I find out if Mesh3P is the right one to use?

ThirdPersonCameraArm->AttachTo(Mesh3P, “test”); // attach it to the third person mesh on the headSocket: test

EDIT: nvm, it works.