Line trace to trigger events? C++

Is it possible to trigger multiple events using a line trace? For example if there was a house with doors that a player had to look at and press a button to open the door, or look at s leaver and press a button to rotate

Do you mean multiple events at the same time? When you do a line trace you can do them by Channels or object types. You can start the point from your camera location and end it ahead of you by a given number.

The resulting OutHit will show you what actor you have hit and where. So you can then cast from that actor to your door for instance and then open it.

What about for C++? I know how to make say a door open and close but I am struggling trying to figure out how to trigger that using a line trace.

FHitResult Hit; // The hit result gets populated by the line trace
FCollisionQueryParams params = FCollisionQueryParams(FName(), true);
FVector Start; // Need Setup
FVector End; // Need setup
bool bHit = GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECollisionChannel::ECC_Visibility, params);

You can then use the HitResult struct to get the same info as the one from the blueprint above.

watch this. How To Do Line Tracing Using C++ In Unreal Engine - YouTube