Announcement

Collapse
No announcement yet.

Event Begin when you Push a Button

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

    Event Begin when you Push a Button

    All I want, is a sliding Window when someone pushes a specific keyboard Button.

    I got it so far working, that my window is moving (changing the location on X):


    However, I can't figure out how to trigger this action only, of someone Presses a specific Button on the Keyboard.
    Example: Someone is pressing the Keyboard Button "E" ---> then let's start moving the window.

    And when someone is pressing the "E" Button again, let's move the Window back again to it's initial position.

    Thanks a lot for any little help,
    appreciate it!



    #2
    What you could try is create three events: toggle window, open window and close window and a variable IsMoving and IsOpen.

    Toggle window - Branch(IsOpen - True) - Close door(event) - Branch(IsOpen False) - Open door Event.

    Open window - Branch(IsMoving False) - Lerp to new position - Set Moving to true - On Complete Set Moving to false - Set IsOpen to true.

    Close window - Branch(IsMoving False) - Lerp to starting position - Set moving to true - On Complete Set moving to false - SetIsOpen to false.

    Then you cast from the character via a line trace and trigger the ToggleDoor Event

    Comment


      #3
      Hi BernhardRieder

      Here a video about making a LightSwitch but is the same thing.
      https://www.youtube.com/watch?v=7fUgU1wpBJ4

      You want to "enable input" to the actor when the player comes ccloser
      and start the animation when you hit the keyboard key

      both these two things are covered in the video.

      Simply.
      Add a trigger box to the plane-actor
      Set the input enabled if the player comes in the trigger, and set it off iif the pllayer leaves.
      When hitting the E start your animation timeline.

      Comment


        #4
        so you would want to create a box collider. When inside the box collider you will want to add a blueprint script where onbuttonpressed "input: E" "play animation" and play the 1st sliding door animation.

        To have it slide back a second time you'll have to create and set a booleon variable and and if statement.

        If "haspressed" is false, play the 1st animation
        if "haspressed" is true, play the 2nd animation of it going backwards.

        Comment

        Working...
        X