Announcement

Collapse
No announcement yet.

How to add a falling animation?

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

    How to add a falling animation?

    Does anyone know a beginner-friendly method of how I can add a falling animation to my character's animation blueprint? Recently, due to my own lack of experience with Unreal Engine, I've been working on implementing the jump function using the default SideScrollerCharacter's animation blueprint as a foundation to expand upon.

    Click image for larger version  Name:	blueprint_2.png Views:	1 Size:	50.2 KB ID:	1615285

    I managed to get it working with my own character's original animations and now I want to further expand on my character's animations by adding the falling animations I made but haven't implemented yet. Unfortunately though, I've been having a tough time of finding any tutorials for beginners on how to accomplish this and so I've come here for help on this matter.

    Animation Blueprint Event Graph:
    Click image for larger version  Name:	blueprint.png Views:	1 Size:	141.1 KB ID:	1615286
    Last edited by Hungry Moogle; 05-04-2019, 02:26 AM.

    #2
    when is something falling?
    When the Z Velocity is negative.

    Comment


      #3
      Originally posted by Raildex_ View Post
      when is something falling?
      When the Z Velocity is negative.
      I get that, I just don't know how to implement it into the blueprint. I know that I need to create a Falling variable separate from the Airborne variable I created for the jumping animations, but that's about all I know.

      Comment


        #4
        Well "is in air" is usually used to determine if the player is off the ground and can only tell if the player is off the ground as in a jump but what it does not tell you is how far off the ground is the player as in the state of falling.

        Since the player is always in a constant state of falling you could use a line trace to calculate how far off the ground the player is once the player is in the air.

        https://www.youtube.com/watch?v=6ZFnPliFSX0

        A line trace will return a fair number of variables one being the location of where the trace hits an object, assuming ground distance, you can then have a few different values as to what happens when the player is falling while in air.

        Based on the return value.

        Is the player jumping?
        Is the player falling?
        Can the player survive the fall?

        Clarke's third law: Any sufficiently advanced technology is indistinguishable from magic.
        Custom Map Maker Discord
        https://discord.gg/t48GHkA
        Urban Terror https://www.urbanterror.info/home/

        Comment


          #5
          I created a new Blendspace that combines the Jumping animation with the Falling animation based on this tutorial I found. I also created a new animation for transitioning from the idle animation into the falling animation. However, the problem now is how I incorporate the transitional animations into the state machine since the Is Falling component doesn't distinguish between whether or not character is jumping or falling.

          Is it possible for the Transition Rule to have a setup where the IsFalling variable is connected to a branch condition which would use the zVelocity variable used in the Jump/Fall Blendspace to determine whether or not the Transition Rule goes into effect? If not, is there anything else that can be used to distinguish jumping or falling for the Transition Rule? FrankieV suggested using line trace but I have absolutely zero experience with it and watching the linked video only made things even more confusing for me.

          Anyways, I created a flowchart illustrating my new theoretical setup for incorporating the falling animation, I hope this helps in trying to figure out how to make this whole thing work.

          Click image for larger version

Name:	flowchart.png
Views:	1
Size:	9.5 KB
ID:	1615568

          Comment


            #6
            Hello, somebody had recently a similar questions, I've made some screenshot : https://forums.unrealengine.com/deve...t-blend-spaces maybe it can help
            Facebook page : https://www.facebook.com/Otholithe-g...6187709110889/
            YT channel: https://www.youtube.com/channel/UCuS...IIFzVZZVmfniug
            Discord : https://discord.gg/sRaBU3

            Comment


              #7
              Originally posted by Grot13 View Post
              Hello, somebody had recently a similar questions, I've made some screenshot : https://forums.unrealengine.com/deve...t-blend-spaces maybe it can help
              Thanks for finding that, although I haven't been able to replicate this blueprint.

              Click image for larger version  Name:	image_162667.jpg Views:	1 Size:	142.8 KB ID:	1615886

              I can't seem to find the Character Movement node, whatever that node is with the multiple outputs reading Velocity X, Velocity Y & Velocity Z, and I don't know what that node is connected to the Movement Mode node.

              Comment


                #8
                Hello, sorry to response so late

                Click image for larger version

Name:	Image-4.jpg
Views:	1
Size:	502.0 KB
ID:	1617153
                Facebook page : https://www.facebook.com/Otholithe-g...6187709110889/
                YT channel: https://www.youtube.com/channel/UCuS...IIFzVZZVmfniug
                Discord : https://discord.gg/sRaBU3

                Comment


                  #9
                  Originally posted by Grot13 View Post
                  Hello, sorry to response so late

                  Click image for larger version

Name:	Image-4.jpg
Views:	1
Size:	502.0 KB
ID:	1617153
                  Okay, so I changed the Event Graph in my character's animation BP to look the one in the screenshot you posted.

                  Click image for larger version

Name:	event_graph.png
Views:	1
Size:	135.8 KB
ID:	1618229

                  However, I am still having some problems in implementing the falling animation such as how I can't hook up the Character Movement variable to the Movement Mode.

                  Click image for larger version

Name:	jump_transition.png
Views:	2
Size:	57.0 KB
ID:	1618226

                  There's also the problem of this node. I have no idea what is and I am unable to find it in the list of Actions.

                  Click image for larger version

Name:	unknown_component.png
Views:	1
Size:	16.6 KB
ID:	1618227

                  Then there's the issue of the Transition Rule for transitioning from the Jumping/Falling animation to the Landing animation. The problem is that the Transition Rule used the Airborne variable and now that the variable is no longer in use, the Landing animation no longer plays like it should.

                  Click image for larger version

Name:	landing_transition.png
Views:	1
Size:	18.5 KB
ID:	1618228
                  Attached Files

                  Comment


                    #10
                    My bad, you need to cast to your character before setting the character movement component (promoting the variable without casting gave you a pawn movement component instead of your character movement component) :

                    Click image for larger version

Name:	Image-2.jpg
Views:	1
Size:	394.9 KB
ID:	1618254

                    Click image for larger version

Name:	Image-3.jpg
Views:	1
Size:	453.1 KB
ID:	1618255

                    Now that your movement component is correctly set you should be able to get the movement mode :

                    Click image for larger version

Name:	Image-4.jpg
Views:	2
Size:	97.8 KB
ID:	1618257
                    Click image for larger version

Name:	Image-5.jpg
Views:	1
Size:	93.4 KB
ID:	1618258
                    And for the transition to landing, the movement mode must different to falling (type "=" and grab "not equal enum") :

                    Click image for larger version

Name:	Image-7.jpg
Views:	1
Size:	63.2 KB
ID:	1618259
                    Attached Files
                    Facebook page : https://www.facebook.com/Otholithe-g...6187709110889/
                    YT channel: https://www.youtube.com/channel/UCuS...IIFzVZZVmfniug
                    Discord : https://discord.gg/sRaBU3

                    Comment


                      #11
                      Originally posted by Raildex_ View Post
                      when is something falling?
                      When the Z Velocity is negative.
                      might need some thought that, is mistaking velocity with direction
                      Last edited by Flying P; 05-15-2019, 01:44 PM.

                      Comment


                        #12
                        try this Click image for larger version  Name:	Anmerkung-20190515-193720.png Views:	1 Size:	50.0 KB ID:	1619881Click image for larger version  Name:	Anmerkung-20190515-193852.png Views:	1 Size:	13.1 KB ID:	1619882Click image for larger version  Name:	Anmerkung-20190515-193937.png Views:	1 Size:	15.7 KB ID:	1619883
                        Last edited by Flying P; 05-15-2019, 01:46 PM. Reason: sorry last image should have been with the is falling variable, but you get the idea

                        Comment


                          #13
                          It still isn't working , for some reason it now plays the Fall_Start animation when jumping & falling despite the fact that the Fall_Start animation isn't currently hooked up to anything. In addition, every time I quit playing I get the following error message:

                          Click image for larger version  Name:	error.png Views:	1 Size:	24.3 KB ID:	1620992

                          I have absolutely no idea what this error message is about, on top of my animation blueprint setup playing the wrong animation. Not helping matters is that this whole endeavor is starting to feel like a giant byzantine mess that I can't even begin to decipher. Can anyone else make sense of this insanity and help me figure out what is wrong?

                          Character Animation Event Graph:
                          Click image for larger version

Name:	event_graph.png
Views:	1
Size:	282.9 KB
ID:	1621003

                          State Machine Setup:
                          Click image for larger version  Name:	basic_actions.png Views:	1 Size:	56.7 KB ID:	1620994

                          Idle/Walk/Run > Jump Start:
                          Click image for larger version  Name:	blendspace_to_jump_start.png Views:	1 Size:	55.6 KB ID:	1620995

                          Idle/Walk/Run > Jump Loop:
                          Click image for larger version  Name:	blendspace_to_jump_loop.png Views:	1 Size:	30.8 KB ID:	1620996

                          Jump Start > Jump Loop:
                          Click image for larger version  Name:	jump_start_to_jump_loop.png Views:	1 Size:	26.9 KB ID:	1620997

                          Jump Loop > Landing:
                          Click image for larger version  Name:	jump_loop_to_landing.png Views:	1 Size:	18.2 KB ID:	1620998

                          Landing > Idle/Walk/Run:
                          Click image for larger version  Name:	landing_to_blendspace.png Views:	1 Size:	25.6 KB ID:	1620999
                          Last edited by Hungry Moogle; 05-18-2019, 12:50 AM.

                          Comment


                            #14
                            First error I see is in your transition from idle to jump start, the movement must be equal to falling instead of different to

                            Second error in your transition from jump loop to landing, you are using your aiborne variable which is not set anywhere, use instead your movement component->different to falling

                            Then it is not really an error but instead of using "time remaining (ratio)" try to use "Time remaining" < 0.1 ( for both "landing>idle" and "jump start>jump loop" transitions)

                            Also instead of using begin play try to use "event blueprint initialize animation"
                            A last thing to check is that your animations, exept fall loop, are not set to looping
                            Facebook page : https://www.facebook.com/Otholithe-g...6187709110889/
                            YT channel: https://www.youtube.com/channel/UCuS...IIFzVZZVmfniug
                            Discord : https://discord.gg/sRaBU3

                            Comment


                              #15
                              Originally posted by Grot13 View Post
                              First error I see is in your transition from idle to jump start, the movement must be equal to falling instead of different to

                              Second error in your transition from jump loop to landing, you are using your aiborne variable which is not set anywhere, use instead your movement component->different to falling

                              Then it is not really an error but instead of using "time remaining (ratio)" try to use "Time remaining" < 0.1 ( for both "landing>idle" and "jump start>jump loop" transitions)

                              Also instead of using begin play try to use "event blueprint initialize animation"
                              A last thing to check is that your animations, exept fall loop, are not set to looping
                              I did all the things you've suggested (except for changing the time remaining to < 0.1 because it causes problems with my animations, 0.5 I find works a lot for me) and it has fixed a number of issues such as the error messages I was getting but I'm still having issues.

                              Click image for larger version

Name:	basic_actions_2.png
Views:	1
Size:	42.4 KB
ID:	1621302

                              The problem is that now when my character jumps he looks like this while either jumping or falling:

                              Click image for larger version

Name:	midair_problem.png
Views:	1
Size:	113.1 KB
ID:	1621305
                              At first I thought my character was stuck in the default T-Pose while in mid-air, but after checking the Jump/Falling Blendspace animation file I discovered the actual problem. The problem was that my character was actually stuck in-between the jumping and falling animations with no way to transition between the two animations. The reason for this was because the Jump/Fall Blendspace was setup to transition from the jumping animation to the falling animation with a variable called zVelocity, but the current Blueprint setup doesn't take that variable into account, so the Blendspace cannot transition from one animation to the other.

                              Click image for larger version

Name:	midair_problem_2.png
Views:	1
Size:	304.5 KB
ID:	1621306

                              Since that setup wasn't working I decided to go with another idea I had. Since I originally created the jumping & falling animations in multiple pieces, I decided to instead string all of the various pieces together without using the Blendspace file.

                              Click image for larger version

Name:	basic_actions.png
Views:	1
Size:	49.4 KB
ID:	1621303

                              Unfortunately, this didn't work out either as my character would instead use the falling animation for jumping in addition to falling.

                              As far as I can tell, the problem seems to be that the animation blueprint doesn't distinguish between the act of jumping or falling and as a result it ends up only using one of the animations for both actions.

                              Both the Jump Loop > Jump to Falling & Idle/Walk/Run > Fall Start transition rules use the exact same setup while the Landing transition instead uses a Not Equal to Falling component. Is the fact that the former two mentioned transition rules as well as the Blendspace to Jump Start rule all use the Equal to Falling component a possible source of the issue or is there something else I'm missing?

                              Jump Loop > Jump to Falling & Idle/Walk/Run > Fall Start transition rule:
                              Click image for larger version

Name:	blendspace_to_falling__jump_to_falling.png
Views:	2
Size:	29.5 KB
ID:	1621304

                              Landing rule transition:
                              Click image for larger version

Name:	landing.png
Views:	2
Size:	29.3 KB
ID:	1621308

                              Blendspace to Jump Start rule transition:
                              Click image for larger version

Name:	image_162667.jpg
Views:	3
Size:	142.8 KB
ID:	1621307

                              Also, I made sure make a copy of my project before I overhauled the animation blueprint just to be on the safe side, just in case I need to revert back to the first setup. So I was wondering which setup is more preferable for the animation blueprint?

                              Comment

                              Working...
                              X