Announcement

Collapse
No announcement yet.

Accessing Root Motion movement data in Blueprint?

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

    Accessing Root Motion movement data in Blueprint?

    Is there a way to access the movement data that an AnimMontage is feeding to the player capsule, so that it can be modified or altered dynamically (in blueprints)?

    I'm putting together a melee system and each attack animation, being a complex full-body anim, relies on root motion to function. I've set up my AnimMontage and everything is working as expected, but I've got a small problem. See, I want to be able to change the orientation of the character in between attacks, both so that the player can retarget the attacks manually and (down the line) so that any lock-on system I implement can do the same thing automatically if the targeted enemy moves relative to the player.

    The problem is, because extracting root motion is enabled, ALL other motion is overridden as long as the Montage is active. There's no way to supply ANY sort of player input unless the Montage is stopped (via function or natural expiration of the anims). What I'd like to do is get the AxisInput data at the moment the melee button is pressed and then, at "allowed" moments, rotate the root as indicated. But I can't do that unless I can apply that rotation info to the info supplied by the Root Motion pilot, since by default Root Motion replaces all other input data.

    The best solution I've come up with to this problem is to get the current AnimMontage section at the start of every attack, then Stop Montage, then take the movement data, then Play Montage with the section name I just got. The problem is this looks like butt, because the animation treats the Stop Montage as its cue to return to the input pose of the Slot, meaning the character transitions back to the idle state and then restarts the attack again (which results in a flickering, jittery character anim rather than the frame-to-frame transition between attacks I've animated). And even if I can get that to work with some clever caching of poses, it still seems like being able to see that root motion data would be a more elegant way to solve the problem, as well as some others I've been having (such as having to scale the root motion keyframes 12x to account for Blender's scaling of the root bone on export and Unreal's subsequent shrinking of the extracted root data), and honestly I just can't imagine there isn't SOME way to get at it that I'm just too dumb to have discovered.

    #2
    Sadly I also don't know how to do it but I'm very interessted to see if there is a solution or something we can come up with to make it work. Creating a melee fighting system for 3d brawler games is something which I haven't found a lot of documentation or info.

    Comment


      #3
      I'm happy to share what I've come up with so far, most of it works quite well, but without being able to rotate the character it winds up kind of limited.

      I've got a semi-functional approach to the rotation too, but as I said it looks kind of wonky. I have an "if moving" event being sent to my anim blueprint whenever the movement input != 0, which I use to cancel wind-down/resheath anims (if the anim reaches the "end" stage, it will play itself through back to the idle stance, but if it sees a movement input, it immediately stops the AnimMontage so that the player can move sooner). What I currently can do is also use this event in conjunction with a notify at the first frame of every attack anim to Stop Montage, Delay (by a fraction of a second), Restart Montage. This causes the game to briefly interrupt the attack animation if the player is pressing a movement key when the attack starts. The issue is that this causes the game to snap back to the idle pose for that instant, which doesn't look good.

      It's also not quite the functionality I'd like. For starters, the PROPER way to do directional attacks is to only take the direction at the moment of attack inputs, not at the moment of anim start (so if I press Melee, then Right + Melee, the queue'd second strike should face right, even if I'm no longer pressing the stick/key to move that way). For another, this creates a problem with lock-on logic since lock-on logic doesn't have manually-transmitted "change direction" commands, it just updates the new look direction every tick (or it should), which means that if you're locked-on the anim will ALWAYS interrupt.

      The more elegant way would be to apply the player's new orientation to the root motion data at moments set in the animation by notify, and let that orientation be updated whenever.

      Comment


        #4
        not sure if it'll work for you but for my game I created another AnimMontage version of my attacks and didn't turn on Root motion.... 0.01 secs later (after the player input rotation has adjusted) I play the Root Motion version (note I also turn up the players turn rate to some super high number so the turn happens in an instant)....
        because there's no StopAnim there's no Idle Animation playing in the middle of the attacks.....
        Very much a crappy work around and I'd love to see some better control over Root motion in Blueprints but for now I can adjust the direction of my attacks in between root motion combos....
        Good luck....keep us updated if you find anything that works as I'm sure we're not the only 3 looking for solutions......
        Last edited by President; 07-07-2014, 03:59 PM.

        Streams: www.Twitch.tv/BlinkTheory
        Patreon: www.Patreon.com/BlinkTheory

        Comment


          #5
          Originally posted by President View Post
          not sure if it'll work for you but for my game I created another AnimMontage version of my attacks and didn't turn on Root motion.... 0.01 secs later (after the player input rotation has adjusted) I play the Root Motion version (note I also turn up the players turn rate to some super high number so the turn happens in an instant)....
          because there's no StopAnim there's no Idle Animation playing in the middle of the attacks.....
          Very much a crappy work around
          Actually it's freaking genius.

          A huge, HUGE amount of work though, and I'd like to hold off implementing it for now in the vain hope that someone at Epic swoops in with a better solution.

          Comment


            #6
            https://www.youtube.com/watch?v=EGGfu-t4RO8

            I made a separate montage for each attack and SetRotation to the new direction between attacks/tumble based on a variable controlled by branch points - using branch points as the UE3 notifies.

            Comment


              #7
              Originally posted by AdAstra View Post
              https://www.youtube.com/watch?v=EGGfu-t4RO8

              I made a separate montage for each attack and SetRotation to the new direction between attacks/tumble based on a variable controlled by branch points - using branch points as the UE3 notifies.
              Yes, in the end doing a "Set Actor Rotation" befor playing the montage with root motion manage to do the trick.
              The rotation can be easily grabed from the input axis and converting that to a rotation angle.

              Thank you very much!

              Comment


                #8
                Originally posted by draquod View Post
                Yes, in the end doing a "Set Actor Rotation" befor playing the montage with root motion manage to do the trick.
                The rotation can be easily grabed from the input axis and converting that to a rotation angle.

                Thank you very much!
                Indeed, many many thanks to AdAstra. In fact, Set Actor Rotation works with root motion currently active, it doesn't have to come BEFORE playing the montage. For example, my combo exists entirely in a single montage (so I can use "set next section" commands to cue one attack to occur after the currently playing attack, rather than jumping right to it, when you mash the attack input), and any time I call Set Actor Rotation it does so without interrupting playback.

                That STILL doesn't mean we shouldn't be able to access the root motion input data in blueprints (hint hint, Epic), but it handily solves the problem currently facing me and I tip my hat for the solution.

                Comment


                  #9
                  Originally posted by President View Post
                  not sure if it'll work for you but for my game I created another AnimMontage version of my attacks and didn't turn on Root motion.... 0.01 secs later (after the player input rotation has adjusted) I play the Root Motion version (note I also turn up the players turn rate to some super high number so the turn happens in an instant)....
                  because there's no StopAnim there's no Idle Animation playing in the middle of the attacks.....
                  Very much a crappy work around and I'd love to see some better control over Root motion in Blueprints but for now I can adjust the direction of my attacks in between root motion combos....
                  Good luck....keep us updated if you find anything that works as I'm sure we're not the only 3 looking for solutions......
                  Did you ever figure out a better way to do this. I just came up to this point where this was an "issue" but using your method seems to work. I'm in 4.8 now and i'm suprised this is still something we can't do. It works, but a tab bit combersome, but for an action game, this is important. but thanks for the idea!
                  www.omegabluestudio.com
                  Twitter

                  Comment

                  Working...
                  X