Getting child component from actor



ADoorTrigger *HitDoorTrigger = Cast<ADoorTrigger>(HitResult->Actor);
if (HitDoorTrigger){
    HitDoorTrigger->Destination->GetComponentLocation();
    //etc...
}


The Cast<>() will convert the hit result pointer into your custom door trigger class if you hit a door trigger, letting you access its members like the Destination component. If it’s not a door trigger the Cast will return nullptr, so that allows you to check it and only do certain code if the hit actor is a certain type. Cast<>() is very important for a lot of things in UE4, so it’s worth learning how to use it.