About collision box for interaction with object

Hi.

I am trying to make a smart system with my interaction box trigger but I am pretty much falling at every turn ://

I’m trying to set a collision box for a door or something you can interact with that displays a interaction button to be press to open the actual door or interact with something. I got it working at 70% so the msg shows and the interaction works but I can interact within the collision box even when not face the object(bump:(:(:frowning: ). So I alrdy have a line trace set up for my items interaction but i was wondering if there was another way (then line trace ) to manage where my actor is facing so that once im in the trigger box collision the interaction text only shows when facing the object like the door or something suspicious.

You should use “Line Trace By Channel” on your character. And whenever it will see the trigger, it will open door.

When creating the interaction widget why not have it trace before hand say 60 times 1degree each just make a forloop from 0 to 59 index and the line trace would be typical but the ending position would be rotated 1 degree each time,

I dont have an editor open right now but playing around with the idea of only creating the widget if the trace can hit the object that will be interacted with within a certain angle. Traces are very cheap.

You could also play with forward vectors right vector applied to rotators or how about a simple get actor world rotation.

Your character for example is always going to be rotated 0 to 180 and -179 to 0 so you can do a check before creating the widget if the angle if within a certain range. I think theres even a rotation range or angle range node.

Hope this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

Hey nsomnia.

Could you simplify a bit what you are saying plz. Where would you be putting the Check rotation. Id like to use the get actor wolrd rotation. The widget is my character UI so its always on in the background till you enter a collision that creates the text for the interaction. I want the text to be on only if character is within range and facing the object.

I did the line trace by channel but the problem i get is that when exiting the box collision well the text doesnt dissapear because of the line trace. it only works if i dont face the door or object.

Alright

Seems like i manage to make it work with trial and error. I went to the source of the line trace in my_character BP and put a branch when the line trace would be sent so if it doesn’t find a target (my collision box) then it’s gonna reset my created message to nothing so it erases it. Basically I deleted the outer collision i created and kept the one that was surrounding the door mesh so the line trace as something to hit. And voila. now i need to face the object for the msg to show and when i lose sight. The message reset to none so goes away.

If anyone tumbles on that problem I hope I gave you guys a quick easy solver. Sorry Nsomnia my knowledge of all that you where proposing is not wide enough. How ever if you ever can show me a simplify version of what i just did I’d be more then happy to try that instead.

Cheers