Download

ACharacter Flying Mesh

ACharacter comes with a built in Mesh, but I want to switch to a flying mesh when flying. When I try the character is simply without any mesh, although I can see both the skeletal mesh and the flying mesh in properties and both are set with mesh models. Is this possible, and if so how?

I declare my additional mesh as:

.h


TSubobjectPtr<class UStaticMeshComponent> FlyingMesh;

.cpp
// Create static mesh component


FlyingMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh0"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMesh(TEXT("StaticMesh'/Game/Meshes/UFO.UFO'"));
FlyingMesh->SetStaticMesh(StaticMesh.Object);
FlyingMesh->bOwnerNoSee = false;
FlyingMesh->AttachParent = CapsuleComponent;
FlyingMesh->SetCollisionObjectType(ECollisionChannel::ECC_Pawn);
RootComponent = FlyingMesh;