right now when i press one of the keys (Left / Right) the camera just rotates immediately, how do i make it rotate more slowly instead of immediately?
(im new to unreal engine so i don’t know how to do too many things )
Hi @Mr.B0ombastic!
So for this you would add a timeline node! A timeline node with a duration of your choosing, and a float output, with the beginning value being 0 and the final value being 1 (to open the timeline for editing, once you place it on the Event Graph, double-click it).
Then you will have an output float, which you will output to a LERP node, into the Alpha slot. So what that will do is have the two values you put into the LERP node gradually shift.
You will then use a “SET Local Rotation” (not Add). You will want to right-click the lavender rotation pin and then hit “Break” to split the rotation input into X, Y, and Z, and then pass the value into Z.
Let us know if you have any more questions!
Edit: I assumed you wanted to shift 90 degrees one way or the other, but after posting this realized that may not be the case. Would you mind just describing what you’re going for when you press the A or D keys in more detail? Do you want a gradual turn that will stop when you release the key? Or “Press once, change exactly this much”?
would be press once and then it rotates 90 degrees but the problem is the lack of timeline really, thank you so much for the help ill reply again if i got it working or got stuck with anything :))
Timelines aren’t great for user input IMO.
In the case where you want smoother movement, you want a little bit of physical simulation, and/or “easing” towards the desired position.
Typically, you implement this inside Tick. You add a desired camera rotator variable, and update that, and then you ease the camera rotation towards that value. Something like:
“desired camera rotator equals current desired camera rotator plus/minus current input axis value times sensitivity times delta time.”
“current camera rotator equals blend between current camera rotator and desired camera rotator, with a blend value of X fraction”
How you derive X fraction depends on how you want to react to high/low frame rate, and what feel you want. Making X fraction be something like “Min(0.2 + DeltaTime * 2, 1.0)” is usually sufficient, with 1.0 meaning “pick all of the desired rotator” and 0.0 meaning “pick all of the current rotator.”
It’s also somewhat unclear what you really want – you’re currently just making a single rotation when the key is first pressed. Typically, you’ll map A/D to an input axis, and you’ll update the desired control rotation of the player controller based on that axis, and then you’ll have the desired control rotation control the camera, and possibly the character direction as well.
You might want to start over with the default FPS setup, and then just edit the control maps to make A and D affect the rotation input axis; that might better map to what you want to do?
Awesome ok, what I had in mind was correct! I’m assuming some sort of dungeon crawler is in mind like the old D&D delver or Wizardry experiences.
I just wanted to note- you want your input to be on the “Play from Start” on the timeline, and you will want to use a bool and a branch. Maybe “Is Turning”? Have a branch directly after your input checking if “Is Turning” is True/False, if FALSE, continue. Directly after, Set “IsTurning” to TRUE, then after everything plays, set it to false again.
That way you can’t turn multiple times on accident, or turn one way and the other at the same time!
(What jwatte said above, though I wouldn’t call it beginner friendly, I vehemently agree with as it would return far greater reliability and realism to an active gameplay style- unless it were to be set value turns in such games that do so, which seems to be the case here.)