From 3ac39c2aaf805ba7ac9917abd78e58a64775321c Mon Sep 17 00:00:00 2001 From: jyelon Date: Tue, 29 Aug 2023 20:05:10 -0400 Subject: [PATCH] Spawning a TangibleActor --- Content/TangibleActor.uasset | 4 ++-- Source/Integration/IntegrationGameModeBase.cpp | 5 +++++ Source/Integration/IntegrationGameModeBase.h | 3 +++ Source/Integration/engineutil.cpp | 7 +++++++ Source/Integration/engineutil.hpp | 2 ++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Content/TangibleActor.uasset b/Content/TangibleActor.uasset index 3aeee539..a94642e8 100644 --- a/Content/TangibleActor.uasset +++ b/Content/TangibleActor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cea9c1c5c294585eb7645105a4e1d438397861240126b64fc847748ec8702afa -size 22486 +oid sha256:da60f617e9dee01bb356f95c3e539d403c0adc101c0ceabb60145a82789a4a85 +size 28327 diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index 19724980..60761a03 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -191,6 +191,11 @@ void AIntegrationGameModeBase::BeginPlay() ThreadEvent = FPlatformProcess::GetSynchEventFromPool(false); Thread = FRunnableThread::Create(this, TEXT("Worker Thread")); } + + // Create a tangible. + UWorld* w = GetWorld(); + AActor* aa = engineutil::CreateTangible(w, ClassTangibleActor); + Tangibles.Add(aa); } void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason) diff --git a/Source/Integration/IntegrationGameModeBase.h b/Source/Integration/IntegrationGameModeBase.h index b3921039..aec295f4 100644 --- a/Source/Integration/IntegrationGameModeBase.h +++ b/Source/Integration/IntegrationGameModeBase.h @@ -46,6 +46,9 @@ public: // Transfer console output from the Luprex engine to unreal. void HandleLuprexConsoleOutput(); + // Array of tangibles. + TArray Tangibles; + // This stores the entire text currently visible in the console. engineutil::ConsoleOutput ConsoleOutput; diff --git a/Source/Integration/engineutil.cpp b/Source/Integration/engineutil.cpp index 0e2635c8..cc68b2ea 100644 --- a/Source/Integration/engineutil.cpp +++ b/Source/Integration/engineutil.cpp @@ -76,6 +76,13 @@ void ConsoleOutput::Truncate() { } } +AActor* CreateTangible(UWorld *w, UClass* uclass) { + FVector location; + FRotator rotation; + FActorSpawnParameters params; + AActor *result = w->SpawnActor(uclass, &location, &rotation, params); + return result; +} } // namespace engineutil diff --git a/Source/Integration/engineutil.hpp b/Source/Integration/engineutil.hpp index 1e42b434..736a91d7 100644 --- a/Source/Integration/engineutil.hpp +++ b/Source/Integration/engineutil.hpp @@ -43,5 +43,7 @@ public: void ClearDirty() { Dirty = false; } }; +AActor* CreateTangible(UWorld *w, UClass* uclass); + } // namespace engineutil