Announcement

Collapse
No announcement yet.

Input Held Down?

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

    #16
    Using Steve Alison's blueprint above, I'd say you'd get the hold time variable, clamp it between 0 and 3, and multiply it by your base amount of impulse/force, then set a new variable for the force_applied to the cube. OnReleased you'd get that force_applied variable for the impulse amount.

    Disclaimer: I am an amateur at blueprinting/coding

    Comment


      #17
      Originally posted by zombat View Post
      Using Steve Alison's blueprint above, I'd say you'd get the hold time variable, clamp it between 0 and 3, and multiply it by your base amount of impulse/force, then set a new variable for the force_applied to the cube. OnReleased you'd get that force_applied variable for the impulse amount.

      Disclaimer: I am an amateur at blueprinting/coding
      Going to have a go tomoz been tied up with the day job recently, cheers for the input

      Comment


        #18
        Originally posted by steadiworkz View Post
        Can anybody help me create a similar action but i'm currently not having much luck with.
        I want to create a charge effect when a key is held down, the longer its held for the greater the charge force is although I do want to clamp a maximum force say at 3 seconds you can't go beyond that strength.
        For example you have simple box simulating physics, when you press space bar it adds force upwards and jumps. The longer you hold space the higher it jumps but when you reach 3 seconds you can't get any more charge.
        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.

        Comment


          #19
          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.
          Ah I like the sound of this, seems like a much more elegant solution

          Comment


            #20
            You can also use Retriggerable Delay loop back and control when the value is read. See pic:
            Click image for larger version

Name:	loop.back.delay.jpg
Views:	1
Size:	115.4 KB
ID:	1064345

            Comment


              #21
              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.
              https://www.patreon.com/MMaxwell
              https://twitter.com/Michael25991355

              Comment


                #22
                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

                Comment


                  #23
                  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

                  Comment


                    #24
                    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?

                    Comment


                      #25
                      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.

                      Comment


                        #26
                        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.

                        Unpopular Minion on the Play Store (Released: January 31, 2016)

                        Comment


                          #27
                          "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.

                          Comment


                            #28
                            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.

                            Comment


                              #29
                              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

                              Comment


                                #30
                                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!

                                Comment

                                Working...
                                X