Overlapping not registered when actor is spawned

I see this thread is pretty fresh and I’ve just fased with this issue in similar case. My procedural mesh ignored character on spawn. The working solution for me is updating overlaps as for procedural mesh, as characters I want to check. I see UpdateOverlaps is not BP exposed function, so C++ is required

    ProceduralMeshComponent->UpdateOverlaps();

	FVector origin = GetActorLocation();
	TArray<AActor*> foundActors;
	UGameplayStatics::GetAllActorsOfClass(this, ACharacter::StaticClass(), foundActors);

	// Iterate over the found actors and check their distance to the given location
	for (AActor* foundActor : foundActors) {
		// Calculate the distance between the actor and the specified location
		float distanceToActor = FVector::Distance(foundActor->GetActorLocation(), origin);
		if (distanceToActor <= Radius + 200) {
			if(auto character = Cast<ACharacter>(foundActor)) {
				character->UpdateOverlaps();
			}
		}
	}
2 Likes