Hey Und3rratetGamer
We are happy to see you here. Asking your questions in early stages of game development is totally normal and a very good habit imo.
Let’s work out your problem. I’ll follow your way of doing this and try to fix it where necessary.
Your code has some problems:
1- You are plugging New Track 0 to make rotator. This is wrong because New Track 0 is supposed to be a variable to control time and not the rotation (We want the door to be opened in a duration of time. That’s why we are using TimeLine node).
2- You are not using a Lerp node. Lerp node is basically in charge of changing a value (in this case the Z rotation value) based on a third value called alpha (in this case it is time stored in form of a float in New Track 0)
3- You are enabling input on the character instead of the door. (As explained above by @Everynone) You are implementing input on the door actor. So, you need to enable input on door actor.
Here’s how to fix these problems:
First make sure your New Track 0 variable is set properly.
Length is the amount of time it takes to open the door. Set it to 1 for now.
Add 2 keys with Add key to CurveFloat.
For one point set both Time and Value to 0.
For the other set both to 1.
Now go back to Event Graph and do the following:
Right Click on New Rotation of the Set Relative Rotation node and choose Split Struct pin so you have access to each axis rotation separately.
Delete Make Rotator node and add a Lerp node. Connect New Track 0 to Alpha pin of Lerp node. Set A to 0 and B to 90. Then connect the return value of Lerp to New Rotation Z (Yaw) of Set Relative Rotation.
. This means over period of time Alpha (Here we set it to 1), Yaw goes from 0 to 90.
You should have something like this:
After that disconnect the wires that go from As BP Third Person Character to target input pin of Enable input (As @Everynone mentioned above). This means now the target is self which is actually the door. So, any input (in my setup is O and in your setup is E) that is implemented on door will now work.
Note make sure the trigger box is greater than the door because you need to enter box area in order to Enable Input. It should look something like this:
With that done, compile and play. Enter trigger area and everything should work fine.
Although this is not a recommended way of doing this (As @Everynone mentioned), learning about why your method did not work will increase your experience.
Have fun!