Download

How to do the right thing Root motion montage? And another problem

Good afternoon, everybody!
I’m a beginner!
I really want to make my own game.
I’m facing a repulsive problem.
I want to hit the enemy, and he flew away from the hit.
I made a punch animation for the character and a fall animation for the enemy. I have a few problems.

1.The first problem is that after the strike, the enemy takes three steps backwards as in the animation, but its capsule component remains in the same place, where he was standing. How do you fix it?

Here is code Zombie animbp


here is code ZombieBP

here is bp character

here is zombie animgraph

2.The second problem is that the strike is not fixed once, but several times, because the collision hitbox on the leg touches the enemy’s collision several times.

3.The third problem I can’t solve is how to make the hero hit the enemy and not miss if the enemy is in the strike zone?

4.And my biggest problem is how to bite a zombie?
I really want the enemy to be able to bite my hero like in resident evil. So that the zombie would grab the character and bite him, and the character couldn’t escape for a few seconds?

I would be very happy to hear from you for your support and advice. Thank you very much!

(I attach high resolution files in reply post down)

It could be

The animation BP is not being told that you using root motion.
The imported animation is not told that it’s root motion based animation.
The animation might not contain root motion animation but rather using the hips to translate the movement which will cause the player to move out of the capsule.

If all things being true the capsule will glue it’s self to the root and move along based on the animation applied to the root.

You should play your getting hit/die animations from a montage via a slot instead of directly inserting them into the state machine. You can take advantage of root motion while playing montages to move the capsule.

Your animation will need to have root motion for this to work. I believe the default setting for montages will play root motion but you can check on that.

Probably because of the large number of pictures, you can’t see my next questions.

2.The second problem is that the strike is not fixed once, but several times, because the collision hitbox on the leg touches the enemy’s collision several times.

3.The third problem I can’t solve is how to make the hero hit the enemy and not miss if the enemy is in the strike zone?

4.And my biggest problem is how to bite a zombie?
I really want the enemy to be able to bite my hero like in resident evil. So that the zombie would grab the character and bite him, and the character couldn’t escape for a few seconds?

I would be very happy to hear from you for your support and advice. Thank you very much!

Did I get it right? Do I have Root motion in this animation?
Do you have any example from YouTube in mind?

I would be glad if you could show me an example, on the forum or on YouTube, how it should be done correctly.
All my animation from Mixamo

Well using Mixamo animations is your problem.

read this

The root of the problem is ,pun intended, is Mixamo animations do not contain the required root bone so that the animations are referencing ground.

No that is not enough. For one thing AnimBlueprints have default setting to accept root motion from montages only. With your current AnimGraph you’d have to update that to accept root motion from everything in your AnimBlueprint class defaults.

But you don’t really want to do that unless you are willing to deal with the added complexity of creating a root motion only controller. Playing hit/die animation should be run from montages as per defaults. Add a Slot node to your AnimGraph and move your hit animations to an external montage that you can then play on the slot as required while all locomotion animation remain where they are.

Check the docs on how to create a montage and play it with a slot in your AnimGraph.

I tried other animations, now root follows the zombies, but the capsule stays in place. Do you know why this is happening?

I don’t know how to do it all through anim montage. I’ve got four kinds of animation responses.

  1. The zombies get hit from the front and take 3 steps back.
  2. The zombies get hit from behind and make 3 steps forward.
  3. The same to the left.
  4. The same to the right.
    Today I tried to figure out how to do it, sat for 8 hours and I failed.
    I will be very grateful to you if you or someone else show me how to do it.

Everyone has days like that especially when starting out. Here is a youtube video setting up a montage https://www.youtube.com/watchv=5DR7pxGouWE
This one has punch animations but the same principle will apply to hit animations.

It is really just 3 steps

  • Build your montage by adding animations to it
  • Name sections for each hit animation in your montage
  • Play the montage when hit with the correct name