Code snippet:
Constructor
{
BoxTrigger = CreateDefaultSubobject<UBoxComponent>(FName("DoorTriggerArea"));
BoxTrigger->InitBoxExtent(TriggerScale);
BoxTrigger->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
BoxTrigger->SetCollisionResponseToChannel(ECollisionChannel::ECC_PhysicsBody, ECollisionResponse::ECR_Overlap);
BoxTrigger->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);
BoxTrigger->bGenerateOverlapEvents = true;
BoxTrigger->SetSimulatePhysics(true);
BoxTrigger->SetEnableGravity(false);
BoxTrigger->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
BoxTrigger->OnComponentBeginOverlap.AddDynamic(this, &UDoorTriggerComponent::OnBoxBeginOverlap);
BoxTrigger->OnComponentEndOverlap.AddDynamic(this, &UDoorTriggerComponent::OnBoxEndOverlap);
}
void UDoorTriggerComponent::OnBoxBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
UE_LOG(LogTemp, Warning, TEXT("%f"), SweepResult.GetComponent()->GetMass());
}
The OtherComp, OverlappedComp, SweepResult.GetComponent() all point to the trigger box, not the colliding object.
The events are fired normally, when i enter the collision area the even is fired but for some reason the parameters get messed up. Could anyone help me?