Good day,
I’ve a scene component (Door handler) that I can add to any door and makes it openable by pressing a Key.
In Mycharacter.cpp, I try to cast to my uscenecomponent, but it fails regardless whatever I do and I don’t see a clear reason why, every other casting throughout my codes work fine.
void AWLL_CharacterChild::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
{
if ( (OtherActor != nullptr ) && (OtherActor != this) && ( OtherComp != nullptr ) )
{
UDoorHandler* TempDoorHandler = Cast<UDoorHandler>(OtherActor->GetRootComponent());
if(TempDoorHandler)
{
if(OtherActor == TempDoorHandler->GetOwner())
{
DoorHandlerFunction = TempDoorHandler;
}
}
else UE_LOG(LogTemp, Warning, TEXT("CASTING TO DOOR HANDLER FAILED - CharacterChild [OverLap Function]"));
}
}
I tried to replace this with the above but with no luck.
UDoorHandler* TempDoorHandler = Cast<UDoorHandler>(OtherActor);
I’ve been trying to do every possible option I know of but it always fails to cast,
Any suggestions?