Hello!
I have 3 instances created from a for in c ++
AMyActor::AMyActor()
{
PrimaryActorTick.bCanEverTick = true;
Box = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("box"));
Box->SetCollisionProfileName(TEXT("Trigger"));
Box->bMultiBodyOverlap = true;
Box->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::BeginOverlap);
RootComponent = Box;
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
ECP = ()->GetFirstPlayerController()->GetPawn();
Box->ClearInstances();
for (size_t i = 0; i < 3; i++)
{
Box->AddInstance(FTransform(FVector(i * 180.0f, 0, 0)));
}
}
from the “BeginOverlap” event I want to delete the specific instance where the event occurs, and keep the other instances.
void AMyActor::BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
OverlappedComponent
}