Overlapping not registered when actor is spawned

Have you tried enabling this in the Class Defaults?


Just tried it, no change, still no overlap on spawn after load.
I also tried moving along the X-axis with 1 and with 10, I tried “Set Collission Enabled” on load, and I tried “Is Overlapping Actor”, no solution yet …

Hello, faced same problem here is the solution: set in collision presets ignore the object you need, for me it was pawn, and then in begin play set collision response to channel to overlap.

5 Likes

This is actually not a working solution, the proper way to do it would be to use GetOverlappingComponents which detects components/actors that are inside your collider instantly.

If you want to detect Overlaps on existing actors you need to use the function GetOverlappingComponents from your collider. ( GetOverlappingActors does not work because it only returns actors that have newly entered the collision volume since the last frame ).

On the receiver actors make sure you have another component (for example the Mesh) with GenerateOverlapEvents set to true and the collision channel set to “CharacterMesh”.

Then on loop through the elements returned by GetOverlappingComponents, get the owner actor of the overlapped component and process what you want to do with it.

3 Likes

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();
			}
		}
	}
1 Like

Thanks! your suggestion is the only one that worked for me.
In my case I needed the FHitResult.Item which stores the index for instanced static mesh components, which you don’t get from a GetOverlappedActors() or a GetOverlappedComponents.
Tried getting the index from a GetInstancesOverlappingBox but that would not match my original primitive collision and therefore the begin and end overlap events wouldn’t be correct.
And UpdateOverlaps() is not doing anything in my case.

1 Like

I have the same problem, i have an aura which if i activate and the actors are awready in it then they need to go out and back in to apply the effect. I tried to change get overlapping actor to get overlapping components and i checked that the actors mesh “generate overlap events” but it still do not register them if the aura spawn when they are awready in it and has again to get out and back in for it to work :frowning: is there anything i am missing for this to work?

I awso tried this one but it has the same effect and is not working for me :frowning:

if it’s simple shape,you could use sphere trace,box trace.they are almost the same with collision box.

1 Like

You mean a sphere trace to check if someone is in there ? Sounds pretty good acctually. I will try it out and see if i can make it.

The shape is different depending on the enemy actor. Some are small and some big ones ^^

1 Like

the size doesn’t matter,you can always adjust the trace radius.

I don’t know why but it fails to find any actor. I can clearly see the debug lines of the sphere trace overlapping the actor… (the tag is awso spelled correctly it works further down there on the code on begin overlap…Actor awso blocks visibility in collision settings)

and i put here 2 boxes to calculate the distance between this aura…

Am i doing it wrong ? It aways print string the fail one…

I found some work around. First of all i do have a skill where i spawn a sphere collision and if i spawn it on an actor inside of it then it register the overlap. So not sure why this skill works as intendet. Anyway the difference on this one vs my aura is that the aura is on the player character and it only gets activated where the other skill spawns a completely new actor in the world. So spawning the aura does seem to work and registering actors awready inside of it. Now i changed the aura as well to spawn in the world and not anymore be inside the player character and this seems to fix it…

1 Like

This doesn’t work for me. Here’s what I did to test:
Function library:

void BlueprintFunctionLibrary::UpdateOverlaps(AActor* Actor) {
	Actor->UpdateOverlaps();
}

Then in blueprints:

When the boxes are overlapping and I press play, it doesn’t trigger the event:

The event gets triggered only after I move them manually out and then in: