Jump Sword Attack Movement: Driven by Animation or Vector?

Hey,

i’m thinking about some 3rd Person Sword Attacks, like Link does in Ocarina of Time, and i’m not that skilled in animating.

://www.zelda/ocarina3d/_ui/img/gameplay/jumpattack.jpg

So my question is: How would i manage to let him move the jump distance?
It will be triggered by using “Attack” when he has locked vision on an enemy.

Would i let the animation do this by animating the distance?,

OR

Would i let him jump on the spot (animating him on the spot) and move him in UE4 with some vector math?

:smiley: Maybe this is a dumb question, but in Unity i was able to do walking both ways.

This is also a general question, because i have multiple jumping moves (backwards and sideways) and the question comes up for every one.

Either
-create something like a jump cycle (as you can see in the 3rd person template) -> when the player presses W+Jump the character will move forward, otherwise he will stay where he is. Depending on how exactly you want to implement your jump attack, you can also let him always move when you play the jump (e.g with a “set velocity”)
-or use a root motion animation -> then the character will stay at the landing position. :slight_smile: https://docs.unrealengine/latest/INT/Engine/Animation/RootMotion/index.html

Probably there are other ways, but those are the ones that came to my mind :smiley:

Whether the character is moved in the animation or code depends on your game, there is no “better” way.

The question is as simple as do you want your character to actually move vertically for interaction purposes when he attacks or is it just aesthetics for the attack to look good?

Root Motion sounds good. If my english is well enough, it says that the Animation moves the character mesh forward and “Root Motion” keeps the capsule always at the Root Point of the Bones.
So that we always have the collision etc at the right place.

I think there are pros and cons to both ways. And that is what i’m asking for. That this question depends on my game is pretty clear, although i didn’t know if code driven movement is possible
for this kind of animation. I would need to match the speed of the animation exactly to make it look good.

I guess i will try to really let the mesh move with the animations and use Root Motion to keep track of the capsule etc.

Is it right, that i can use a transition between the Jump and some “Jump was blocked” animation to let the character get repelled by a shield or something?
Like: “If SwordJump && Enemy->Blocking == True” -> Transition to some throw back animation, although the Mesh Movement depends on the Animation.
It’s hard to imagine all of this without knowing much about it :smiley:

Sorry, i’m really bad at animation. I am more a coder :D, but i need to get some simple animation ready to test Zelda(Link) like Movement.

Yes, you can do something like that. e.g

When the player presses the left mouse button the character will play the jump attack animation - when he overlaps with the shield a bool variable gets activated which either stops the animation (he will fall back into idle) or you can also play another animation (that he gets pushed back and falls on his back). Therefore I would use a montage -> you have more possibilities to controle the animations.

I use the same technique for my combat/blocking system

(: This sounds like so much fun! xD Now i only need animations. Let’s start some blender sessions :X

Gameplay programming is fun! :smiley: Just for testing purposes you could use the animations from the “Couch Knights” project -> there you can also see how epic games made the “jump attack” ^^

Oh they had a jump attack? I only remember a 2 Combo Attack and a sprint :open_mouth: Nice i will have a look at that.

But i will need some more information. I will need:

  • Roll
  • 3 Combo Swing
  • Block
  • Round Swing (don’t know how to call that)
  • Idle
  • Attack Idle
  • Lock on Enemy Idle
  • Lock on Enemy Sideways Movement
  • Lock on Enemy Backwards Flip
  • Lock on Enemy Jump Attack (what i meant)
  • Lock on Enemy Sideways Jump
  • Lock on Enemy Roll (maybe use normal Roll)
  • And maybe some more xD

That’s why i thought it would be better to get some information about the ways to implement animations, than doing everything and finding out that i did it wrong in the first place.

When you dont have experience with the implementation of animations, I would recommend you to take a look at this video series: It will teach you all the basics :slight_smile:

One hint that I can give to you is, to plan your animations very carefully (which animation should have root motion, which animations do I need,…) , because it will save you plenty of time (otherwise you will have to overwork many animations,…)

e.g
-roll forward - roll forward left - roll forward right -> root motion
-combo swing -> do I need one with root motion or shall I just use the upper body for the attacks,… :slight_smile:

(: Thanks for the advide. I don’t know yet if using the combo swing will move the character some steps forward. Then i would need the root motion again or? :smiley:

I really need to learn how to apply these layers (e.g. upper body only). I have this fixed setup from Unity in my head, but i guess it will work nearly the same.

Yep, in that case root motion will be beneficial. :slight_smile:

Here the interesting part of the 3rd person bp tutorial starts: The stuff with the layers is really easy.

Worth noting: root motion does not, by default, create aerial/Z motion.

So your “jump attack” will play a jumping animation but your character’s capsule will remain grounded. This is fine for the most part, but it can create edge cases; if you try to jump-attack across a gap or over a short obstacle, the capsule won’t complete the “jump” like the animation suggests.

If this is a problem for your game, I suggest using root motion (to control the wind-up and step-in), but then using a Branch Point to trigger an event that Launches the character forward at a specific point in the animation so that he actually becomes airborne.

Of course the problem with doing THIS is you then need to divide your animation up into two parts, and program the second part to trigger only when landing; that way if you use the jump attack off a ledge, the game won’t try to “land” it until the character is once again grounded.

1 Like

What do you mean with “launches forward”. Isn’t there a way to force the capsule to launch? And if i launch the character, will the root motion then use the z axis too?

I mean the normal jumping function. Doesnt it launch the char? :open_mouth: i knew that i needed to “unground” the char to use landing animation and the loop the jump but changing zhe grounded variable isnt enough then?

Oh there’s actually a function available in BPs called “Launch” which applies an instantaneous force in a direction (either additively, or replacing velocity components) and sets the movement mode to Falling.

If you use your Branch Point’s event in your AnimBP to hit a Cast node (JumpAttackLaunchBranch > Try Get Pawn Owner > CastTo MyCharacter > JumpAttackLaunchEvent) you can call a custom event on your Character BP which Launches the character based on his current forward vector; e.g. Get Actor Forward Vector > Vector * Float (e.g. 800) > Vector + Vector (to add like 200 Z or something so the character arcs through the air a bit) > Launch, override XY, override Z)

That’s how I do it for my Skydrop attack, anyway (where the player plummets downward and then hits the ground in a landing).

EDIT: To answer your specific question, telling the animgraph “he’s not grounded” won’t achieve anything. The capsule will constantly report that it is IS in fact grounded unless it’s actually not touching a surface it can stand on.

And being airborne, the Z values of root motion WILL be applied, but remember that gravity will still affect the capsule, so it won’t work like the animation suggests. If you really want to have total anim control over the aerial position of the actor, you need to either make him airborne and disable gravity or, alternately, set the movement mode to flying. That way, only the root motion controls where the capsule is.

Personally I think it’s easier (since it’s just a jump and not something like a complex aerial maneuver) to just use the Launch node and not worry about root motion for that point of the anim. You’ll have to tweak the XY and Z values of the aforementioned Launch a bit to get it to feel how you want, but in the end it will work better.

Alright (: thanks man! I will have a look at this. I don’t think that i need a 100% correct moving capsule. It’s enough it is airborne some way.

Got a small related question: Is it possible to just export the Blue Hero Model from Epic Games with alle Bones? I’m afraid not.

If not it’s ok. I will make my own test character and rig it, but if it’s possible, it would save me some time.

Normally it should be possible -> right click onto it - export - fbx :slight_smile:

Yes, but i read something about the Rig not being exported with it. Because the most work is the weight :X Ok i will just try to export it to blender.

Maybe i’m lucky because then i just need to animate it for testing.