UnrealEngine
Unreal Engine (UE4) ANavMeshBoundsVolume Spawn
Angler.lee
2020. 2. 27. 16:17
ANavMeshBoundsVolume 객체를 C++에서 스폰하려고 하니.... collision 0 영역이라고 오류 메시지를 출력합니다..
엔진 소스를 검색해서 에디터 모드 일때 Volume 들을 스폰 할 수 있는 명령들을 찾았습니다..
아니 이 간단한 몇줄이.. 왜케 찾기 어려운 것 일까요.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | UWorld *world = GEditor->GetEditorWorldContext().World(); UNavigationSystemV1* NavSystem = UNavigationSystemV1::GetCurrent(world); ANavMeshBoundsVolume *nmbv = NULL; nmbv = Cast<ANavMeshBoundsVolume>(AddActorFromClass(ANavMeshBoundsVolume::StaticClass())); NavSystem->OnNavigationBoundsAdded(nmbv); AActor * FHumanStudioEditorModule::AddActorFromClass(UClass * ActorClass) { AActor* NewActor = NULL; if (ActorClass) { // Look for an actor factory capable of creating actors of that type. UActorFactory* ActorFactory = GEditor->FindActorFactoryForActorClass(ActorClass); if (ActorFactory) { FTransform transform = FTransform::Identity; NewActor = GEditor->UseActorFactoryOnCurrentSelection(ActorFactory, &transform); } } return NewActor; } | cs |