6 #include "Engine/CollisionProfile.h" 10 ARuntimeMeshActor::ARuntimeMeshActor(
const FObjectInitializer& ObjectInitializer)
11 : Super(ObjectInitializer)
12 , bRunGenerateMeshesOnConstruction(true)
13 , bRunGenerateMeshesOnBeginPlay(false)
15 #if ENGINE_MAJOR_VERSION >= 4 && ENGINE_MINOR_VERSION >= 24 16 SetCanBeDamaged(
false);
18 bCanBeDamaged =
false;
21 RuntimeMeshComponent = CreateDefaultSubobject<URuntimeMeshComponent>(TEXT(
"RuntimeMeshComponent0"));
22 RuntimeMeshComponent->SetCollisionProfileName(UCollisionProfile::BlockAll_ProfileName);
23 RuntimeMeshComponent->Mobility = EComponentMobility::Static;
25 #if ENGINE_MAJOR_VERSION >= 4 && ENGINE_MINOR_VERSION >= 20 26 RuntimeMeshComponent->SetGenerateOverlapEvents(
false);
28 RuntimeMeshComponent->bGenerateOverlapEvents =
false;
30 RootComponent = RuntimeMeshComponent;
35 if (RuntimeMeshComponent)
37 return RuntimeMeshComponent->GetRuntimeMeshMobility();
44 if (RuntimeMeshComponent)
46 RuntimeMeshComponent->SetRuntimeMeshMobility(NewMobility);
52 if (RuntimeMeshComponent)
54 RuntimeMeshComponent->SetMobility(InMobility);
60 if (RuntimeMeshComponent)
62 return RuntimeMeshComponent->Mobility;
64 return EComponentMobility::Static;
67 void ARuntimeMeshActor::OnConstruction(
const FTransform&
Transform)
69 Super::OnConstruction(Transform);
71 if (bRunGenerateMeshesOnConstruction)
77 void ARuntimeMeshActor::BeginPlay()
81 bool bIsGameWorld = GetWorld() && GetWorld()->IsGameWorld() && !GetWorld()->IsPreviewWorld() && !GetWorld()->IsEditorWorld();
83 bool bHadSerializedMeshData =
false;
84 if (RuntimeMeshComponent)
86 URuntimeMesh* Mesh = RuntimeMeshComponent->GetRuntimeMesh();
93 if ((bIsGameWorld && !bHadSerializedMeshData) || bRunGenerateMeshesOnBeginPlay)
99 void ARuntimeMeshActor::GenerateMeshes_Implementation()
bool ShouldSerializeMeshData()
::geometry_msgs::Transform_< std::allocator< void > > Transform