Basically what I’m trying to achieve is a universal “Use” function for the player.
I want to press E to pick up physics objects or activate buttons and doors depending on what is in front of the player.
I created a “Use” Actor component C++ class that successfully traces a line from the player and reports a hit on actors.
I created a custom collision channel and called it “Door”;
I added my new collision channel to the trace parameters like so (telling the trace to only detect physics objects and Doors):
FCollisionObjectQueryParams(ECC_TO_BITFIELD(ECC_PhysicsBody) | ECC_TO_BITFIELD(ECC_GameTraceChannel1)),
Now thats nice and dandy but I’d really like to be able to detect which collision channel the trace encountered.
If i could return the Hit collision channel, then in my Use function I could Flow control what to do next (Pick up object, open door, push button, talk…)
**If there is a better way to achieve this please let me know!