Announcement

Collapse
No announcement yet.

Input Held Down?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • started a topic Input Held Down?

    Input Held Down?

    Hello all. For input events, I see that there are outputs for Pressed and Released. How about when, say the left mouse button, is held down and having it continue to activate the output? If there is a way to detect that, is there a setting for the delay between each time the event is fired while it is held down, or would I need to use a delay?

  • replied
    Not to bring a dead thread back to life, but I implemented my own system using only the game time, a bool and simple arithmetic if anybody is interested. You just get the game time when the key is pressed, record it, then get the game time when the key is released and record it. Subtract the value from when the key was released by when the key was pressed, and if the difference in time is larger than a predefined value, then it will trigger the held boolean value and switch the branch to the Held function. Click image for larger version

Name:	HeldKeyFunc.png
Views:	1
Size:	88.2 KB
ID:	1623589

    Leave a comment:


  • replied
    Originally posted by mxnko View Post
    You can also use Retriggerable Delay loop back and control when the value is read. See pic:
    [ATTACH=CONFIG]20380[/ATTACH]
    Thanks! It what to need)

    Leave a comment:


  • replied
    Here's a good way to get the Widget Interaction Component and your 3D Widget working with a MOUSE CLICK.


    Go into your Characters blueprint.

    1. +Add a "Widget Interaction" component from the component window.
    2. +Add a "Widget" component from the component window.
    3. Make sure the Widget Component has your Widget of choice in the 'widget class'.

    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	309.2 KB
ID:	1116285

    These are my settings for the Widget interaction component:
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	368.2 KB
ID:	1116286


    Go into the graph editor of the blueprint widget you selected before.
    Find your desired button, (or whatever you are using. I've only tested this for buttons), you want to work with the Widget Interaction component.
    Click the ">OnHovered" Event for that button.

    Then do this for that OnHovered event:

    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	102.5 KB
ID:	1116282


    It is worth noting I have another identical button that gets created on top as soon as the button (involved in this tutorial) is clicked. That means if I added this system to that new button it will jump into a fast loop requiring the need for a doOnce node.
    Attached Files
    Last edited by TroJanVirus; 10-06-2016, 05:37 AM.

    Leave a comment:


  • replied
    why there are no hold down button event ?? is it hard to make one ? pls epic team make an event for hold down button .

    i spent all day to find a good method and found this which it worked for me and my IQ i think raised by +1 after losing during research

    here it is ,a R delay hope it will work for you guys :

    Click image for larger version

Name:	hold.jpg
Views:	1
Size:	147.7 KB
ID:	1106497

    ignore the branch of hold jump its part of my project , and the event you want to be trigger put it instead of "start floating event " .
    Last edited by mhnoni; 05-16-2016, 04:53 PM.

    Leave a comment:


  • replied
    Originally posted by Steve Allison View Post
    From the Get Player Controller node, you can use the Get Input Key Time Down node:

    [ATTACH=CONFIG]58[/ATTACH]

    The the input you are checking against is set with the Key input and the return value is 0 if the key is up or the cumulative time the key has been held otherwise. You can set up comparison that returns a boolean and use that to power a Branch or WhileLoop, which ever you want to use.

    Hope that helps out!

    -Steve
    Hi Steve,

    Is there an equivalent for this for touch screens?
    Sometimes my game interprets the starts of swipes as a touch and fires off the touch action by accident.
    I'd really like to implement a minimum time for how long I'd like a touch event to last.

    Thanks!

    Leave a comment:


  • replied
    Originally posted by Distul View Post
    Here is another solution that will set a 'power' variable determined by seconds held.

    This doesn't involve timers or ticks.

    Under the Normalize to Range node "Range Max" is the time in seconds you want the button to be held in order to achieve max power.

    The float multiplier node just after holds the value of what your max power should not exceed.

    In my example if the button is held 4 seconds or longer the result 2000 is produced. If held down for 2 seconds 1000 would be produced.

    So on...

    SET X_DIFFERENCE is not actually needed and can be removed from the blueprint.

    [ATTACH=CONFIG]37687[/ATTACH]

    Not tested but should work.

    The downside to this method is that you cannot update anything in real-time in relation to X_Pressed since there are no timers checking the values. You must wait until X is released before this will fire off. It has limited uses but is fairly efficient and problem free.
    Unfortunately, I cannot make this work as I would want to. X Power should never be more than 2000 in your example, right? I don't know why, but I am using this exact blueprint and my X Power is always bigger than the number inside the multiply node? I am a noob still, so I'm sorry if I said something wrong. Cheers

    Leave a comment:


  • replied
    Originally posted by Interitus384 View Post
    [ATTACH=CONFIG]20402[/ATTACH]

    A gate might also work for having a button being "held down" Could hook it up to Event tick or the timer as shown, depending on the use.
    Thank you so much for this! I really needed it.

    Leave a comment:


  • replied
    "The downside to this method is that you cannot update anything in real-time"

    yes you can: on tick, subtract X_Start from GetGameTimeInSeconds.

    you really don't need the "X_End" variable at all, you only need to keep track of the starting time, and you can subtract it from the current time whenever you need to get elapsed time. elapsed time is updated so frequently that its a waste to store it in a variable, and more efficient to do the subtraction every time you need it.
    Last edited by ScottSpadea; 05-21-2015, 05:40 AM.

    Leave a comment:


  • replied
    Here is another solution that will set a 'power' variable determined by seconds held.

    This doesn't involve timers or ticks.

    Under the Normalize to Range node "Range Max" is the time in seconds you want the button to be held in order to achieve max power.

    The float multiplier node just after holds the value of what your max power should not exceed.

    In my example if the button is held 4 seconds or longer the result 2000 is produced. If held down for 2 seconds 1000 would be produced.

    So on...

    SET X_DIFFERENCE is not actually needed and can be removed from the blueprint.

    Click image for larger version

Name:	power_per_seconds_held.png
Views:	1
Size:	127.9 KB
ID:	1075605

    Not tested but should work.

    The downside to this method is that you cannot update anything in real-time in relation to X_Pressed since there are no timers checking the values. You must wait until X is released before this will fire off. It has limited uses but is fairly efficient and problem free.
    Last edited by Distul; 05-03-2015, 01:35 PM.

    Leave a comment:


  • replied
    Originally posted by JoeWintergreen View Post
    I don't see a Get Input Action Time Down
    If you deselect the 'Context Sensitive' checkbox when you are searching for new nodes then you will find the Get Input Action Time Down. I had to do that.

    Leave a comment:


  • replied
    Has anyone tried this method to make an input action trigger after a set amount of time? I'm trying to get my character to go prone when the Crouch button is held down after a short amount of time, instead of tapping it. I'm trying to save on button mappings for game pads while also keeping the ability to remap down the line by not using the "is key held" function, as some users have stated that this can prevent/break remapping at a later date. Does anyone know of a proper config for this to work?

    Leave a comment:


  • replied
    Fixed it with thanks to James on https://www.facebook.com/groups/unrealfour/

    Click image for larger version

Name:	ChargedJump.JPG
Views:	1
Size:	62.7 KB
ID:	1064662

    Leave a comment:


  • replied
    Originally posted by Keeperofstars View Post
    Use a timeline for this. start the timeline on pressed, fire when released or finished. Can set the curve along the way to be your value for either vector or float, etc. Set the timeline to end at 3 seconds, which will cause the finished output to fire. That way you can get values all the way along the curve, and they are easily adjusted as needed.
    Pre make the curve as a content browser asset and reuse it in numerous locations if needed.
    I'm just trying this out but I can't get it to work yet.
    My original Blueprint looks like this.
    When I release space it fires an impulse that is represented by "float Jump Power".
    Click image for larger version

Name:	JumpSimple.JPG
Views:	1
Size:	54.4 KB
ID:	1064425

    I would like the "float Jump Power" to be controlled by a timeline, say a value of 0 to 2000 over a timescale of 2 seconds.
    When I release space I want the float to be triggered so that if I hold key a short time I get a little impluse and if I hold it for a long time I get the maximum value (2000).

    Currently I have this but its firing all the time so I need some way to trigger it when space is pressed but not update the float until its released.
    Click image for larger version

Name:	JumpTimeline_00.JPG
Views:	1
Size:	55.2 KB
ID:	1064426

    I hope this makes sense ?
    Attached Files

    Leave a comment:


  • replied
    Originally posted by Wisdomcube2000 View Post
    Hey just checking on this post to see if there has/will be any progress with a Held option for the input alongside the pressed/released options.)
    Click image for larger version

Name:	GateExample.jpg
Views:	1
Size:	83.5 KB
ID:	1064364

    A gate might also work for having a button being "held down" Could hook it up to Event tick or the timer as shown, depending on the use.

    Leave a comment:

Working...
X