Announcement

Collapse
No announcement yet.

Blender to Unreal: Root Motion Not Applying

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

    Blender to Unreal: Root Motion Not Applying

    Hello, Unreal community! May I just say you look fabulous today?

    So here's the problem, which I initially posted in the UE4 AnswerHub (https://answers.unrealengine.com/que...blems-wit.html). I'll try to re-explain with the new knowledge I have.


    I've been trying very hard for the past few months to get something with root motion to import successfully from Blender (2.74) to UE (4.8), but with little success. After trying many different things to get some models in, I finally decided to make the least complicated model I could, just to try and figure out how to get things to work. Here are the results:

    First, my model in Blender. About as simple an armature model as possible, with only two bones, and a three frame forward walk animation.

    Click image for larger version

Name:	BlenderArmature.png
Views:	1
Size:	15.2 KB
ID:	1154764

    After going through some of the things mentioned below (Some "Solved" Things) on AnswerHub, I got a nice little walking box-creature root-motion animation. However, I am unsure how to get this from the animation into the actual game, and therefore have several questions which have plagued me for quite some time.

    In order to apply root motion to an actor:
    • Does the actor need to be a blueprint?
    • If so, does the blueprint need to have "Character" as a parent, with Character MovementMode set to walking (as was told to me in one of the originally provided links)?
    • Does the actor need to have an animation blueprint, or can root motion work through a simple animation asset?

    And if those are all the case, why is it that way?


    I have yet to get the root motion to show up in the actual game (though in the animation window with Show -> Process Root Motion checked, it looks perfect).

    Unreal has great documentation, and this article on root motion (which I have read numerous times) was no exception.

    However, it still does not answer my questions. As it was written when AnimMontages were still necessary for root motion, I am unsure in what situations root motion now applies. The only clue I have is the following: "To fully utilize Root Motion, your character will need an Animation Blueprint", which I cannot decide whether it means an Anim Blueprint is necessary, or that it is simply very useful in most situations.

    Again, in the animation tab with "Process Root Motion" checked, everything looks wonderful, but I cannot figure out how to transfer this to in-game. I have tried making my Actor into a blueprint, giving it an Animation Blueprint, and having it extend Character with MovementMode set to both "walking" and "flying", all to no avail.


    Thanks in advance for anyone who can (or tries to!) help.
    This is most of my question, but I've provided some more information below.

    ~Trekopep






    Some "Solved" Things:

    This is with units in Blender set to metric, with a scale of 0.01, which has been (ctrl-a) applied to both the armature and the mesh. I exported an fbx two times, once using 7.4 binary, and once using 6.1 ASCII, with the rest of the settings like so:

    Click image for larger version

Name:	BlenderExport.png
Views:	1
Size:	51.3 KB
ID:	1154767

    ASCII:
    This version imported seemingly nicely into Unreal. However, when turning on root motion, regardless of which Root Motion Root Lock option I choose, the forward animation "snaps" back into place after moving, rather than continuing forward like it should.

    Click image for larger version

Name:	UnrealArmatureASCII.png
Views:	1
Size:	181.7 KB
ID:	1154765

    Comments: This happens because when using ASCII export/import, unreal adds another root bone to the skeletal mesh, and as I was informed by Blue Man (from AnswerHub) this can be solved by animating the entire armature in Blender instead of the root bone. This has been tested and confirmed.
    However, when actually playing the game, the character did not move at all, despite being set to use the animation asset. (This is the main question.)

    Binary:
    This version imported at 100x larger than it should've. However, when selecting root motion in the animation view, it correctly moved forward, though the correct speed was 100x too slow relative to its body.

    Click image for larger version

Name:	UnrealArmatureBinary.png
Views:	1
Size:	183.0 KB
ID:	1154766

    Comments: As per Adam Davis' suggestion in AnswerHub, I tried exporting from Blender at a scale of 0.01, and it worked. Apparently, the applied in-Blender scale doesn't correctly transfer over in Binary export. (This is what seems to be the case. If you have more information, please share!)
    Again, when actually playing the game, the character did not move at all, despite being set to use the animation asset.


    Also, in case anyone is interested, here are some of the similar problems I've been having, which are also unresolved, the first one especially being very related to this:

    https://answers.unrealengine.com/que...f-intende.html https://answers.unrealengine.com/que...h-seeming.html
    Last edited by Trekopep; 07-03-2015, 02:56 PM.

    #2
    Hi
    Did you fix your problem?
    Does my solution work for you? (ASCII)
    Assets: Military Ammunition (Released)
    Plugins: BlueManBPFunctionLibrary C++ plugin (Free), Blue Man Vehicle AI Plugin (Released), Air Resistance C++ Plugin (WIP), Blue Man Vehicle Physics Plugin (Marketplace)
    Projects: Giants Of Destruction

    Comment


      #3
      Originally posted by Blue man View Post
      Hi
      Did you fix your problem?
      Does my solution work for you? (ASCII)
      Blue,
      Yes! It did work!
      Unfortunately, while this is an excellent piece of knowledge, it still has the same problem as the Binary version, which is that the root motion works perfectly as expected when viewing the animation asset itself with Show -> Process Root Motion checked, but does not apply the root motion in the actual game.

      Thanks again for the tip. Updating the main post to reflect this information now.

      Comment


        #4
        Originally posted by Trekopep View Post
        Blue,
        Yes! It did work!
        Good to hear

        Originally posted by Trekopep View Post
        Unfortunately, while this is an excellent piece of knowledge, it still has the same problem as the Binary version, which is that the root motion works perfectly as expected when viewing the animation asset itself with Show -> Process Root Motion checked, but does not apply the root motion in the actual game.

        Thanks again for the tip. Updating the main post to reflect this information now.
        Did you set Root motion from everything in your animation blueprint?

        http://i.imgur.com/6WxSO6E.png?1

        And here is good tutorial on how to set up root motion

        https://www.youtube.com/watch?v=bUQ83Szuh7E

        Edit: I think that you need anim montage or you can use anim blueprint.
        Last edited by Blue man; 07-03-2015, 05:36 PM.
        Assets: Military Ammunition (Released)
        Plugins: BlueManBPFunctionLibrary C++ plugin (Free), Blue Man Vehicle AI Plugin (Released), Air Resistance C++ Plugin (WIP), Blue Man Vehicle Physics Plugin (Marketplace)
        Projects: Giants Of Destruction

        Comment


          #5
          Sorry for the delay. I wasn't expecting it to take a month for a company to fix my computer...

          I didn't see much in that tutorial that I haven't already done.

          Yes, I have Root Motion from Everything set, and I'm using an anim blueprint. In the picture below, you can see the Anim Blueprint. As simple as possible, and everything previews perfectly with "Process Root Motion" checked. However, in the actual game, nothing happens. The thing stays still.

          Click image for larger version

Name:	Root Motion in Blueprint.png
Views:	1
Size:	191.3 KB
ID:	1083280

          Comment


            #6
            I have been attempting to apply root motion using C++ without using CharacterMovementComponent, and was able to get it working with a small amount of code. Here is the simplest way I know how to do it. I put this code inside of a Tick function.

            Code:
            FRootMotionMovementParams RootMotion = Mesh->ConsumeRootMotion();
            
            if (RootMotion.bHasRootMotion)
            {
            	FTransform WorldRootMotion = Mesh->ConvertLocalRootMotionToWorld(RootMotion.RootMotionTransform);
            	UpdatedComponent->SetWorldLocation(UpdatedComponent->GetComponentLocation() + WorldRootMotion.GetTranslation());
            }
            "Mesh" is a SkeletalMeshComponent that is animated using an Animation Montage with Root Motion enabled (simply using an animation asset does not work), and "UpdatedComponent" is a SceneComponent that I want the root motion applied to. For my case, I have a Box Collision (UpdatedComponent) with a Skeletal Mesh (Mesh) parented to it.

            Note: I don't believe this can be done in Blueprints without exposing the necessary functions.
            Last edited by GeneticSpartan; 08-09-2015, 09:02 PM.

            Comment

            Working...
            X