Raycast to a trigger

I want to set up a small button for a door. I linked the door with a static mesh object and created a trigger box around it. I want to raycast and detect the triggerbox when I press a button and then I want the door to open. Can I do that in C++?
Basically I want to raycast and detect if I hit a triggerbox using C++.The FhitResult has getComponent which returns UIprimitiveComponent which isn’t what I’m looking for.
Thanks in advance.

I don’t know much about trigger boxes, but they are actors, so if they are hit by the linetrace you can obtain the actor hit using FHitResult.GetActor(). This could then be casted to an ATriggerBox in order to be able to access its’ values.

That being said a TriggerBox may not be the best way to go for this use case, as it appears to be more collision focussed. Maybe you should create a subclass of actor which contains an overridable function that can be run when it is found via a linetrace from your player. Then you can create a new subclass of this, call it a button and override the function to contain logic to open a door?

Anyway, ramblings aside, I hope I helped :slight_smile:

I think you are talking about TriggerActor. Or are TriggerBoxes Actors too?

Yes I believe it is, there is an ATriggerBox in the API

oh yeah, thanks!