11#include "Kismet/GameplayStatics.h"
15 PrimaryActorTick.bCanEverTick =
false;
17 CollisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT(
"CollisionBox"));
18 CollisionBox->InitBoxExtent(FVector(200.0f, 200.0f, 200.0f));
21 VisualizerComponent = CreateDefaultSubobject<UBoundsVisualizerComponent>(TEXT(
"BoundsVisualizerComponent"));
41 Super::EndPlay(EndPlayReason);
81 TArray<AActor*> OverlappingActors;
84 for (AActor* Actor : OverlappingActors)
89 if (InstancedActor && (!OnlyTrees || InstancedActor->
IsTreeActor()))
91 InstancedActor->Destroy();
93 FVector ActorLocation = InstancedActor->GetActorLocation();
94 FString Msg = FString::Printf(TEXT(
"Removed actor from position: X=%f, Y=%f, Z=%f"), ActorLocation.X, ActorLocation.Y, ActorLocation.Z);
99 for (
const FString& Msg : Logs)
void DestroyOverlappingActors(bool OnlyTrees)
UBoxComponent * CollisionBox
UBoundsVisualizerComponent * VisualizerComponent
void ChangeOverlapBounds(FVector Bounds)
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
virtual void BeginPlay() override
static void Log(const FString &Message, bool LogToTextFile=true, bool LogToROS=true)