I placed monster in world and then spawn another pawn (hero) next to it. overlap doesn’t trigger until i click on hero object in world outliner. Its really strange.doing.
Doesn’t work in c++ or in monster blueprint. Only collision i get when i start game is with spectator pawn and not with hero pawn until i click on hero object in world outliner tab.
component i’m using for both pawns is UBoxComponent and i have collision present set to overlap all and generate overlap events enabled.
Edit: it appears that collision components are at 0 and dont move to mesh location until i click on object in scene outliner.
How are you adding your Box Components? Could you provide code?
I have attempted a simple repro using a test blueprint setup, but I haven’t seen same results as you, so seeing your code would be helpful in attempting to reproduce your issue.
So i have a combat menu that only shows if hero and monster are overlapping.
void AMonster::OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
// Check if overlapping actor is an investigator
if (OtherActor->IsA(AInvestigator::StaticClass()))
{
if (HasAuthority())
{
bIsSelectable = true;
Cast<AAHGameState>(UGameplayStatics::GetGameState(this))->AddMonster(this);
}
// Only show combat window to client
auto owner = Cast<AInvestigator>(OtherActor)->GetOwner();
if (owner == nullptr)
{
return;
}
Cast<AAHPlayerController>(owner)->ShowInitalCombatWindow();
}
}
When i start game menu should immediately be showing since hero and monster are overlapping but it doesn’t until i click on actor.
I spawn hero in code but monster i placed in scene.
This is what i see when i just add a hero and a monster to a blank level. Notice collision volumes are not with actors but offset.
![2]:75041-
Edit: After even further investigation it appears that collision components added in code is root cause. i added box components to hero and monster blueprint and they appear at 0 with mesh and trigger collision as expected. So worse case i have a work around but since i’m going to be creating multiple monsters and heros i added collision component in code to save time adding it to each blueprint child