I have already blended the characters idle animation and a running animation however when you play it will not play the blendspace when playing as ThirdPersonCharacter but it will idle only. I have W key set to play animation run in the thirdpersoncharacter event graph. If I disconnect the W key then it will be stuck in a t pose when trying to move. I do not understand how the state machine would know what button corresponds to the run animation if I disconnect the W key from thirdpersoncharacter event graph. My thirdpersoncharacters walk speed is 300 and my float variable called speed is set to 300. I havent put my “is sprinting” variable in yet because I dont know where it would go in the event graph. I want it so when I press W the thirdpersoncharacter activates the blendspace so it smoothly transitions idle to a run. And then the run smoothly transitions to a sprint if I hold shift while holding W. My run to sprint blendspace is 1d and is just run at beginning and sprint at end. My idle to run animation is 1d and is idle at beginning and run at end. The MyCharacter Blueprint Event graph is separate to the ThirdPersonCharacter Event Graph. The ThirdPersonCharacter animation blueprint is MyCharacter. ThirdPersonCharacter is the same skeletal mesh as MyCharacter.
When using blendspaces you should not trigger the walking anims from the Character BP but only focus on moving the pawn.
In the Anim BP you get the velocity correctly and set the speed variable.
The things to check next are:
- Is the cast working? So is the Speed variable ever getting set?
- How is your Blendspace set up?
I unbound the animations in the ThirdPersonCharacter blueprint event graph. I also added a regular blendspace in place of my 1d blendspace from before. Now my character just moves in a T pose when moving. Perhaps I need to add the speed variable someplace in the ThirdPersonCharacter blueprint for it to trigger the regular blendspace.![alt text]
This is looking fine so far. The Speed variable doesn’t need an initial value as it’ll be overwritten in the update anyways. And you don’t need an extra variable in the Character either.
Is the validated get ever valid? Is the cast every working? Try putting debug points with F9 or in the right click menu and check.
Dumb question but you gotta check:
Did you set the AnimBP to the mesh in the character?
I managed to get my ThirdPersonCharacter to basically puppet the MyCharacter Animation Blueprint that I put into the world. I also put the MyCharacter skeleton into the world and it is also a puppet of ThirdPersonCharacter. Currently direction (left and right) of ThirdPersonCharacter is not being noticed only idle, running and sprinting is animated by the MyCharacter Animation Blueprint and MyCharacter skeleton that I put in the game world (they run and sprint in place). The puppet effect only happens if I use Get Player Pawn, or Get Player Character it also causes my screen to fill with false string texts that never display true. If I try to use Try Get Pawn Owner there is no puppet effect and ThirdPersonCharacter does not affect MyCharacter Animation Blueprint, and Skeleton that I placed into the world (they stay in idle animation). The validation is never valid it always is not valid regardless of my input while trying to move my ThirdPersonCharacter. My ThirdPersonCharacter mesh uses the same animation blueprint as MyCharacter.
You should not use the indexed functions for this (GetPlayerPawn / Character). In a multiplayer setup you’d have trouble getting the correct index. In singleplayer, AI characters for example wouldn’t want to reference players anyways. Instead, stick to the references already available (TryGetPawnOwner) and cast, GetController from there if you need it… This is also why the puppet effect happens, as all the AnimBPs get their data from the same pawn (which is not what you want usually).
I am now not quite sure… which character is it you want to animate? If it’s the MyCharacter, you also need to cast to MyCharacter. A cast to ThirdPersonCharacter will always fail (except if MyCharacter is a child BP of TPC).
Here is a quick demo of how it should look. Blendspace should do fine as you posted it above. When setup like this, you don’t need the IsSprinting variable, and you also don’t need an extra state for Sprint as the Blendspace in Idle/Run should cover it. You’d only have one state, feeding the Blandspace the speed and direction you set in the Anim BP as follows:
The Initialize Animation is not necessary either. And the BeginPlay is only called once when the game starts / the pawn is spawned, so setting the IsRunning variable like this will only do it once and not update it. You don’t need it anyways. Hope this clears things up a bit.
That makes sense, I got the blendspace working by rerouting an event begin play on the ThirdPersonCharacter event graph however when I hold w the character does the sprint animation instead of a run. If I tap the spacebar before pressing w then when I hold w it will do the run as it should and holding spacebar does the sprint animation as it should. I am assuming if I want the character to reload or take cover id need to branch off the Event Blueprint Update or create some other Event Blueprint then create variables for that or merge animations by creating an upperbody slot for the animations. In addition to making Reload and Take Cover states in the state machine. Also maybe I should change my Get Player Controller to Try to get Pawn Owner for my HUD. Thanks for taking the time to answer my questions.
LordStuff youre the man. I had been switching between aiming and melee animations and completely forgot to add speed and direction variables to my aim animations. Saved me after 4 hours of grinding and just wanted to say thank you for the good work.
Glad I could help