Lets make a clear answer with a picture of the blueprints because - Ive been researching this and trying to get this to work all day and havent found any other answers that made sense to me.
What I want to happen:
Player walks up to the hood of the M113 APC (Military Vehicle) Presses βFβ and a line trace hits a Collision Box on the vehicle and then the hatch opens.
What that looks like in UE5 Blueprints:
The Logic in the Player after sending a Line Trace:
Ive tried casting to the vehicle actor, casting to component, Im shocked this has been such a difficult thing to do. Could someone post a clear picture for all of us beginners so we can see how this should look in the Blueprints.
So all components need a tag in order for a line trace to work? I feel like the linetrace should be able to register that it hit a particular component? Couldnt I just have a reference from the linetrace because thats the only instance of the component that it hit?
You can make different evaluations of the trace hit component output.
You can also cast it to static mesh, get the mesh of the casted static mesh component and compare the static mesh inside with a static mesh asset but I think that is more cumbersome.
For anyone needing help with the line trace I had setup a βTagβ which is like a codeword for the linetrace to recognize. Each component inside the Actor can be assigned a tag on the right side of the screen with all the options for the component. Also the component receiving the line trace needs to have the proper collision settings in order to return a hit. So if youre using a collision box like I wanted to do, you will have to adjust the settings under collions. The red debug line trace will show a red square if it is registering a hit when you run the project.