So the system with “Hold and release” in the Enhanced input actions have it get triggered after the threshold and if i release it before it doesn’t work. Im trying to have power scale with how long you hold your button down. I currently have this:
But i end up with charge being an uneven number slightly higher than the max threshold ive set.
Is there a better approach to this or is it a simple subtraction if my charge is higher than it should?
Hey @Goltoreth1!
Wait… Your charge variable is increasing? How? That may be located somewhere else.
If “Charge” is starting at zero, it can never be greater than 0,65. Therefore, it can never pass the branch to set the new “Charge” variable.
Hope that helps!
Is there a reason to add the elapsed seconds to the previous frames elapsed seconds and save that as the charge variable? I think it would cause faster frame rates to reach the max charge value faster. If you are using a hold and release trigger with the hold time set to .65 I would just do it like this;
The input action can only ever trigger if it was held for .65+ seconds before released, and canceled will fire if it is held for less than .65 seconds.
1 Like