Hi,
I have currently a project that allow me to switch between a first person view and a third person camera view. I split the body and the head of my character to avoid camera issue with the head when the player is in first person view. Here is my setup :
//Visible by player
MeshBody = PCIP.CreateDefaultSubobject(this, TEXT("MeshBody"));
MeshBody->AttachParent = RootComponent;
MeshBody->SkeletalMesh = skMeshBody.Object;
MeshBody->AnimationBlueprint = skAnimBody.Object;
MeshBody->RelativeLocation = FVector(0.0f, 0.0f, -48.0f);
MeshBody->RelativeRotation = FRotator(0.0f, -90.0f, 0.0f);
MeshBody->CastShadow = true;
MeshBody->bCastInsetShadow = true;
Components.Add(MeshBody);
//Invisible by player
MeshHead = PCIP.CreateDefaultSubobject(this, TEXT("MeshHead"));
MeshHead->SetMasterPoseComponent(MeshBody);
MeshHead->AttachParent = RootComponent;
MeshHead->SkeletalMesh = skMeshHead.Object;
MeshHead->RelativeLocation = FVector(0.0f, 0.0f, -48.0f);
MeshHead->RelativeRotation = FRotator(0.0f, -90.0f, 0.0f);
MeshHead->bOwnerNoSee = true;
MeshHead->CastShadow = true;
MeshHead->bCastInsetShadow = true;
MeshHead->bCastHiddenShadow = true;
Components.Add(MeshHead);
The idea is to hide the head while keeping its shadow. Unfortunately, when I toggle the camera mode I would like to be able to see the head. I tried to change the value of the bOwnerNoSee boolean but it has no effect ingame (or because it’s outside of the constructor ?). I also tried other booleans such as the deprecated “bHidden” and some visibility functions without any success.
Is there an other way to toggle the visibility of my mesh component ?