First you’ll need to use the hitinformation to determine what object you’ve hit.
FHitResult Hit contains the hitinformation after you do the LineTraceSingleByObjectType(). So with hit you can set up a condition soemthing like:
if (hit /*check if hit is valid*/ )
{
Door door = cast<Door>(hit.actor); // check if the actor we hit is a door actor
if (door /*check if door is valid*/ )
{
door->opendoor();
}
}
and that should take care of it. (just using pseudocode, you’ll have to adjust some things)