What is "IE_Repeat" means?

tracked down to this page: link text
and as you see all the “Description” places just left white.

what i want to implement is hold a key for a specific time to trigger something after.
holding ‘Q’ key for 3 seconds to make character performs a special movement, for example.

this is how i do:
1)i bind action to Q key for doing this and select IE_Repeat Input type.
2)record the moment pressed ‘Q’ through GetTicks() method.
3)record the moment released ‘Q’ through GetTicks() method.
4)subtract the twos i got length for holding time.
5)compare holding time to 3 secs, if >= then trigger my event.

but the result is someway weird. i think i might get misunderstand on the meaning or usage for IE-Repeat.

Append

Some of code:

       InputComponent->BindAction("BurstQ", IE_Pressed, this,&AMyPawn::StartBurst);
        InputComponent->BindAction("BurstQ", IE_Repeat, this,&AMyPawn::GoBurst);
        InputComponent->BindAction("BurstQ", IE_Released, this,&AMyPawn::StopBurst);
        
        void AMyPawn::StartBurst(){
            //Get pressed time
        	PressedTime = FDateTime::Now().GetTicks();
        }
        
        void AMyPawn::GoBurst(){
            //reset pressed time to 0 as every time Q key released
        	if (PressedTime == 0) {
            return;
          }
        	int64 HoldingTime = PressedTime / 10000;
            //set BurstThreshold to 3 secs
        	if (HoldingTime >= BurstThreshold) {
            bBurst = true;  //go burst.
          }
        }
        
        void AMyPawn::StopBurst(){
        	bBurst = false;  //stop Burst
        	PressedTime = 0;
        }
1 Like

IE_Repeat means: keep executing this function over and over while key is pressed.

So, if you want to check for 3 seconds, you can:

  • use IE_Pressed (start counting) and IE_Repeat (keep checking until 3 seconds), or
  • use IE_Pressed (start a 3 seconds timer) and IE_Release (stop timer in case less than 3 seconds), or
  • use IE_Pressed (start counting) and keep checking until 3 seconds in the Tick function, or
3 Likes

your explanation was brief while clear. just imiplemented perfectly with 1st approach. cheers!