I’m working with the FPS wiki tutorial, and I have a small problem. I’ve my FirstPersonMesh
working correctly (I think), but I’m still seeing the body mesh in first person despite setting
Mesh->SetOwnerNoSee(true)
in the ctor for my character class. However, I was able to set this in the blueprint editor, and then it worked. Did I do something wrong such that my code isn’t properly updating something?
Here is the entire ctor for reference:
AFPSCharacter::AFPSCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// Create a CameraComponent
FirstPersonCameraComponent = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera"));
FirstPersonCameraComponent->AttachParent = CapsuleComponent;
// Position the camera a bit above the eyes
FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 50.0f + BaseEyeHeight);
// Allow the pawn to control rotation.
FirstPersonCameraComponent->bUsePawnControlRotation = true;
// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
FirstPersonMesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("FirstPersonMesh"));
FirstPersonMesh->SetOnlyOwnerSee(true); // only the owning player will see this mesh
FirstPersonMesh->AttachParent = FirstPersonCameraComponent;
FirstPersonMesh->bCastDynamicShadow = false;
FirstPersonMesh->CastShadow = false;
// everyone but the owner can see the regular body mesh
Mesh->SetOwnerNoSee(true);
}
Thanks! [edit: I’m using engine version 4.7.6]