Hello, I was playing around with the Line Trace system in UE5 to open and close some cabinet doors I have in my scene. The Line Trace works perfect but theres a slight bug. You see when you press the interact key (E) in my game is fires a line trace, then casts to the door BP and opens/closes and a timeline to give it some smoothing. But for opening closing i’m using Flip/Flop between A/B and it’s really buggy and wanted to know if theres a function i’m missing that is better for this use, here are some screenshots.
Place the timeline inside the cabinet actor instead. This way each object can keep track of the state of the FlipFlop which will be the source of the buggy you mention.
If you have more than just cabinets to interact with, it might be a good idea to have a look at how Interface communication works. Otherwise, you’ll be casting all over the place, it becomes tedious rather quickly in such situations.
Ok, thanks i’ll take a look. Also the source of the buggy is that when you press (E)
it creates loads of raycasts so the flip flop is being activated really quickly. The Interface Communications are something I will look into but for now do you know if I can limit the raycast to only happen once when the (E) key is pressed.
Hi @EyeMountain
Are you using a direct key input or the enhancedinput system?
The pressed/triggered repeats the key most likely, if you use the enhancedinput you can use the started or completed (translates to key down and key up) which may stop the repeating for you IF i am understanding this correctly
Thanks, this works temporarily but I will look into how interface communication works as mentioned by @Everynone earlier.