When trying to call the character ‘jump’ function from within an animation BP it fails to jump.
I wanted to call jump from an animation notify event so got a reference to my character and called jump, however the capsule remained on the ground.
I then tried calling jump directly in the character using space bar event and it worked.
I then wrapped the jump function within another function (in character class) placing a print string at the end of the built in jump function and when calling my custom function from the animation BP the string was successfully printed to the screen but it still didn’t jump.
Someone else has raised this HERE
I’m not sure what you’re doing, but have you attempted using the debug filter to diagnose the issue?
I got this working on my end with and without a function. I added a notify at the end of the Idle animation. See below:
Okay, thanks Matt.
I was get a reference to my character using ‘GetPlayerCharacter’ rather than using ‘TryGetPawnOwner’ so perhaps that was my problem. I’ll try this tonight and confirm.
Weird, this is still not working for me…
Here’s my animation graph:
Here’s the Anim Notify on my jump animation:
And here’s my result when I play:
In any case, I think I’m going to tackle my jumping system in the same way as the third person template using start, falling and end animations now so this wont actually be used in my game but there definitely is something odd going on and I can’t figure it out.
Wait, you’re calling jump FROM the jump animation? Jump is supposed to CAUSE the jump animation as well as the capsule movement. That’s why I was confused in the first place why you were using a notify to call Jump.
I do notice you have a bit of a wind-up in your animation though and assume that’s why. I can experiment with this, but this might not be the best method. Can you send me your project? You can PM me a download link on the forums.
You can migrate your character to an example project if you’d like.
The reason as you’ve already guessed is because the animation doesn’t leave the ground until a number of milliseconds have passed. I realise this isn’t the normal or best way of handling jumping and in fact I intend on changing it to a traditional jump system but as I encountered this problem I thought I’d raise it in case it is a genuine bug.
Thanks for taking a look into this.
I’ll PM you the project now.
So, root motion is being applied and your jump anim has root motion on it. If root motion is being applied, then it takes over the capsule…essentially overriding the jump function. I just switched your AnimBP Root Motion Mode to “Root Motion from Montages Only” and it works. If you need the AnimBP to be set to “Root Motion from Everything”, then you need to remove the root motion from your jump animation.
Thanks for this.
The reason I had root motion on my jump animation is because I was under the impression root motion wasn’t applied on the z axis. I’m not sure where I heard that information though. In any case, I had already suspected that root motion may have been the problem and had already tried disabling root motion from the jump animation however it still failed to make the capsule jump (is this a bug perhaps?)
Therefore, in order for it to work, it seems I could either:
only use root motion from montages
animate my root bone on the jump animation
set a boolean in my character class, calling jump from within my character when true
use a delay node after the controller input and call jump from within my character class.
completely change the way I handle jumping (best option)
So it looks like I have a few options, neither of which are ideal but I suppose I’ll have to live with that.
Thanks once again for taking the time to investigate this.
Pawns have to have Flying enabled for Z axis root motion to work. So if you want to do that, you’d need to enable flying and disable it at the end of the jump. It’s a valid method, but I’d recommend using the jump function. By removing root motion, I mean removing it in original maya file/fbx.
I don’t know if you’re going for a certain style of animation that has more realistic anticipation and follow through than is usually afforded to video game characters (snappy controls usually override realistic movement). I’d say you may need to overhaul the way you’re handling character movement or at least jumping (option 5). If you want to use root motion for everything, you kind of have to go all in and ignore the movement functions for the base character class.
Yeah, I was hoping to go all in and do root motion from everything in order to get a ‘hyper realistic’ character. The only animation with a delay was the jump from idle, the running jump leaves the ground on the first frame so the controls are still relatively snappy for when it matters but snappy controls was never really a concern for this project anyway.
The animations I am using are from Mixamo and unfortunately the root bone hasn’t really been animated fully. They have only animated X and Y axis and have not considered the Z axis (so enabling flying wouldn’t work anyway) or even rotations (you may have noticed the insane skeletal mesh rotation logic that I had set-up) so I guess I’ve just been battling against that.
I really do appreciate all your help, I think I’ll probably scrap root motion in favor of a more traditional set-up.
Apologies for the delay as I was out sick. I do think that if this works and the jump is the ONLY problematic animation, then I’d suggest exporting the fbx to Maya/Max/Whatever and adding some vertical root motion. Then as long as you switch flying on whenever you trigger a jump, you should be good. This CAN work, it’s just not how I’d go about it.