How to have a hold button on a toggled animation
Sorry if the title description is a bit confusing.
I have a crouch animation that works on a toggled signal manipulator. And a crawl animation that works on a timer. (Press and hold) So I press circle and I crouch, circle again and I stand up.
So far so good.
Now I want to hold circle and go into crawl mode.
If I am in standing mode and hold the button it goes into crouch mode then crawl mode
If I am in crouch mode and I hold the button down it goes back into standing mode before entering crawl mode. I dont want it doing this but I cant work out the logic to stop the toggle from activating if I hold down the button.
Any ideas?
-
My only idea is to have a timer for a short period of time (like 0.2 sec) that divides a press from hold.
From this I mean detecting if the button is pressed or held, and after these 0.2 seconds going into standing/crouch mode or crawl mode, depending on the button being pressed after the timer finishes or not.
I'm not sure what you need the signal manipulator for, but if it's purely for that logic, that's how it could work without it:
▪Wire the "button pressed" output into "start timer". Timer takes 0.2 secs to finish
▪Have an AND gate with "timer completed" and "button pressed" plugged in. This gate will activate when button is pressed for longer than 0.2 seconds.
▪Have a second AND gate which is exactly the same, but "button pressed" wire is plugged into the NOT gate first. (So, timer output and NOT gate output). This gate will activate when button is pressed only shortly, for less than 0.2 seconds.
▪Then use those to enter different animations.
Of course, if 0.2 seconds is too little for a button press, feel free to try different times out.
I hope such a solution will work! :) If timer resets in the same moment as the AND gate acrivates, this would need a bit more to work. I hope not, haha ^^ -
I made a tutorial on how you can do this with a timeline. https://www.youtube.com/watch?v=nRI75NPHgCQ
Please sign in to leave a comment.