Download

Mesh->SetOwnerNoSee question

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]

Hey, have you figured out why the code’s not working?
I’m currently doing the FPS Tutorial from the Wiki and my code doesn’t do anything either.
I got rid of all the warnings by using GetMesh() instead of accessing Mesh directly, but that
of course didn’t change anything. I only can set these booleans like OwnerNoSee and such
in the blueprints.

Oh i think I got it.
My assumption is that since the blueprint was created before the visibility has been set in the code, the code and the blueprint contradict themselves and the blueprint
seems to have the upper hand in that case. I’ve deleted and recreated the blueprint and now the appropriate checkboxes are checked.

Hi, i’m going through this tutorial now with UE 4.15, it tells me Mesh is no longer accessable as it’s private. Not sure if i’ve done something wrong or thats just the way it is now.

To get around it, i:

  1. Go into blueprint of character,
  2. click on mesh.
  3. Expand rendering in the details tab
  4. select Owner No See

that worked fine, i assume there is probably a code work around which i’d prefer but if not this keeps you going on the tutorial.