How to get the player to sit in a chair?

Hello, I am needing some advice on how I can go about making my character sit on certain objects, such as a chair using blueprints.

What I currently have is the chair I want the player to sit in, as well as the player with the sit animation created. However, what I would like to know is how I can get the player to play the sit animation when the player presses the interact button (‘E’) near the chair, and attach the player to the chair when the animation has been completed. Also be able to press ‘E’ again to stand up.

I have already spent time searching for a solution and tried messing around with the blueprints myself, but I can’t seem to figure it out (I’m still pretty new to how blueprints work). Thank you!

What usually happens in most games if you have noticed in assassin creed or resident evil when you interact with the object the player aligns their self with the object first then they play the sit animation from forward or backwards.

A dirty prototype would consist of moving the player in front of a “sit point” for the chair then play the sit animation.
In the animation states you stay in a sitting loop state until a button is pressed to remove you from the sitting state.

Thank you, but I’m not really sure how to get the animation to be played. Is this done in a blueprint (if so, the player, chair, or other) or in the state machine? I can’t figure out how to play the animation in any of these. If I can figure this one part out, I’m confident that I can get the rest working.

My though process on this would be as follows:

Make a chair class with a collision box in the front of the chair. On over lap pop a interaction text from the chair BP class. From the overlap event you can cast the actor to to the main player and set the interaction object object in the players BP class with the chair. On button press you find the sit position for the chain and align the players location with the sit location. Then set a startSitting variable in the player object.

In the Animation BP check the startSitting variable from the owner pawn and if true set the BPs sitting flag.

In the animtion state once the Animations BP variable is set then enter the sit start animation.

From the start enter a sit loop animation state while the sit flag is true.

Now if the person hits the Interact button again then player then sets the start sitting variable to false an the animation BP will update its variable and allow the stand animation to begin playing.

Thank you! I finally got it to work, but as you said, it is pretty dirty so I need to clean it up to look nice.

I’ll add my result to my helpful function post in tutorials once i do my City NPC AI