I have a door system that works with tracing. However, when I try to close automatically by exiting collision I can’t get it right. What might be wrong? The photos show the code before anything is done with the overlap event. I connected it everywhere with bad results.
As for me, you’re overthinking it a bit.
- Why do you need trace that runs off tick for that? You can launch a trace once when you press E. You’ll have to do that in the Character BP though.
- I don’t know what the curve in your timeline is, but I think you’re using it wrong. Adding the curve value to the current rotation will give you different results depending on the frame rate. You have to either use Ease or Lerp with the Timeline curve as Alpha, or make the curve go from the rotation value when the door is closed to the rotation value when the door is open, but ceratinly not adding.
- When you reverse the Timeline, you still Add the rotation angle. How do you want to close the door, if you keep opening it even further? But if you follow the suggestion in p.2, that won’t be a problem anymore.
Thank you for your reply! I run tick because I want the player (First Person) to be able to locate different cabinets and doors that are next or close to each other, and I want the interaction happening when the player is looking at the door and not just when they are in a trigger and may be looking away but the doors still work.
The curve is working fine until I mess with overlap. I also tried a different (opposite values) one but the results were bad. Any further help will be appreciated, I’m actually a modeler but I got pretty good at handling blueprints in the last months, by using tutorials of course. Thanks again!
- That’s exactly what I’m talking about. If you want to open the door only when you’re looking at it, then a one-time trace on E press would be the perfect solution. You send a forward line trace, and see what it hits. If it hits the door, you send the Open Door command to that very door. No need to use any trigger boxes at all.
- Make two Rotator variables: the door rotation when it’s closed and when it’s open. Create a Timeline with a curve that lineary goes from 0 to 1 in 1 second. Create an Ease node, and feed the Timeline curve pin in into Alpha of the Ease node. Connect Closed Door Rotation to A, Open Door Rotation to B, and the result — to the Set Actor (Component) Rotation of the door.
- Make two functions like Open Door and Close Door, connect them to the Timeline’s Play and Reverse (for a better way, create respective interfaces so that you wouldn’t need to Cast to the Door BP), and when you press E and the trace hits the door, call the Open function of that door, and when you leave the trigger box, call the Close function.
I hope it’s clear from the text, I can’t show you any screenshots now.