18 PrimaryActorTick.bCanEverTick =
false;
20 RootComp = CreateDefaultSubobject<USceneComponent>(TEXT(
"RootComp"));
23 BoxComp = CreateDefaultSubobject<UBoxComponent>(TEXT(
"BoxComp"));
24 BoxComp->SetupAttachment(GetRootComponent());
25 BoxComp->SetBoxExtent(FVector(50, 50, 50));
26 BoxComp->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
27 BoxComp->SetCollisionObjectType(ECollisionChannel::ECC_WorldStatic);
28 BoxComp->SetCollisionResponseToAllChannels(ECR_Overlap);
30 CubeMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"CubeMesh"));
31 ConstructorHelpers::FObjectFinder<UStaticMesh> cubeMeshRef(TEXT(
"/Script/Engine.StaticMesh'/Engine/BasicShapes/Cube.Cube'"));
32 if (cubeMeshRef.Succeeded())
34 CubeMesh->SetStaticMesh(cubeMeshRef.Object);
36 CubeMesh->SetupAttachment(GetRootComponent());
37 CubeMesh->SetCollisionProfileName(TEXT(
"NoCollision"));
38 CubeMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
39 CubeMesh->SetCollisionResponseToAllChannels(ECR_Ignore);
57 UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep,
const FHitResult& SweepResult)
59 if (Cast<Aluggage>(OtherActor))
61 OtherActor->SetActorLocation(
LuggageRespawnPoint,
false,
nullptr, ETeleportType::TeleportPhysics);
63 else if (Cast<AFood>(OtherActor))
65 OtherActor->SetActorLocation(
FoodRespawnPoint,
false,
nullptr, ETeleportType::TeleportPhysics);
void OnBoxBeginOverlap(UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)