This is a function to smoothly zoom in or out the camera using the mouse wheel.
it uses a Gate, a Retriggerable Delay, and a Finterp To nodes for it to work with the old input system.
This doesn’t really work with the Enhanced Input Actions, and if you want to know why, I tried describing it in detail below, and you can also try it yourself, but TL;DR how could I make another smooth zoom in and out system using the new input system?
.
.
.
.
.
.
.
.
Why it doesn’t work:
( can I collapse this whole text somehow, like a spoiler tag in other forums, so most people won’t be scared looking at this enormous wall of text?)
Since the old axis input actions kept firing constantly even when no input was being given, it allowed this function to use the gate node. with a branch checking if the axis value was > 0, it would trigger the open the gate once (since scrolling the mouse wheel would only out an axis value of 1.0 for a tick), and then with a retriggerable delay, keep it opened for one second (enough time to zoom in/out the camera smoothly).
Then with an finterp to, the Arm Length of my character camera spring arm would smoothly increase or decrease for one second, executing the smooth zoom in or out action.
Now, with the enhanced input actions, axis inputs don’t trigger constantly (which is probably better, but i digress), so it won’t keep firing for the finterp to node to smoothly icnrease the spring arm length.
Of course I could do a workaround and use a tick event for it to keep firing, but the problem is that before, the axis value for the mouse wheel would only be 1 (or -1, if you scrolled down) for a tick. so the value for the Finterp to node to work with would only be calculated once, zooming in only a certain distance.
Now, the Action Value for the enhanced input action (which replaces the old Axis Value), keeps sending a value of 1 (or -1) constantly, even though you only scroll up or down with the mouse wheel once, so the Finterp To will keep calculating a value over the 1 / -1 and will always zoom in or out to the maximum range every time, and not to an interval.
I could use the start and completed exec nodes from the enhanced input evet, mixed with a “greater than 0” branch connected to the action value pin to set a float variable to either 1.0 or -1.0 on started, and back to 0 on completed, but not all mouses have the same wheel system, with a well defined step. some of them keep scrolling, some of them stay “clicked” for a bit long, so this wouldn’t work all across.
I could use the mouse wheel as a bool action instead of axis since it doesn’t really gives me any value between 0 and 1 so it could probably work better across all mouses, but this same Input Action event that I’m using for this camera zoom function isn’t only getting data from the mouse wheel, it’s also triggered and receives values from gamepad triggers. Left trigger ranges from 0 to -1 and Right trigger from 0 to 1.
If that was perfectly true, even thought the mouse wheel wouldn’t work perfectly, I could still use the afore mentioned tick event along with the gamepad trigger values to have it working like before. but it also doesn’t work like that.
Gamepad triggers used to work perfectly, returning an axis value of exactly 1 when fully pressed, and exactly 0 when not pressed, and any float in between while pressing through the entire range of the triggers.
But now, they don’t. Based on everything described, this is probably because the axis input events stop firing now when you let them go, so if you just release the trigger, it will -always- stop firing before the axis value hits 0.
So, resulting in a problem similar to the mouse wheel issue, the axis value for the triggers won’t stay at 0, and the Finterp To node will keep adding values to the spring arm length after you let go of the trigger. slow values and only for one second until the retriggerable delay ends, but enough for this function to respond poorly, and not intuitively like a simple trigger press.
needless to say, this new input system isn’t proper for replacing the old one in this function. I tried finding workarounds or even rewriting the code for the new input, but couldn’t come up with anything that would work.