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.
Ok so, it’s not a matter of public/private (C++ doesn’t have public/private classes), it’s the fact that ADoorTrigger isn’t defined in the .cpp you’re trying to use it in, what you need to do is #include “DoorTrigger.h” in the .cpp file that is using the Cast<>() so that it knows what an ADoorTrigger class is. Each .cpp file is compiled separately and only knows about the classes that you #include (and basic classes that MSVC and UE4 always include). This is a basic C++ thing, so you should probably go through some tutorials to get a better understanding, otherwise you’ll run into a lot more problems down the road.
Oh, I forgot that HitResult->Actor is actually a TWeakObjectPtr<AActor>, not a raw pointer, so the argument type is wrong and the compiler is telling you about it. You should use Cast<ADoorTrigger>(HitResult->Actor->Get()). UE4 sometimes uses wrappers around raw pointers, like TSharedPtr or TWeakObjectPtr for safer handling. These pointer wrappers have accessor methods like Get(), or * to give you the raw pointer. You could have used the code suggestions to look at the types of FHitResult::Actor and the arguments that Cast expects and figured this out for yourself though.