So I got Animation Pack of market. I didn’t want to modify original so I created a copy of ASP_Character by right clicking and hit Create Copy. It seems that when you do this, character’s Crouch and Jump features of movement component will no longer work. Walk/Run work fine.
- Using a clean project of any template (I use 3rd person), I setup space bar to be jump and ctrl to be crouch. Set ASP_Character as default pawn in GameMode. Character jumps and crouches fine.
- Right click on ASP_Character, hit create copy (4.4.3) or Duplicate (4.5.0) and name it MyASPCharacter.
- Set Default Pawn in GameMode to be MyASPCharacter
- Attempt to jump or crouch, nothing happens.
- Open Debugger and see that wires show execution is getting to set jump velocity but nothing is happening.
- Diff 2 Blueprints, There are no differences except name change.
- Very very strange!
Unreal Engine 4.4.3, 4.5.0
Windows 7 x64
Nvidia GTX 970 - 4GB
Intel Xeon 5680 - 96GB ram
Asus 27" 2560x1440
I figured this out. It seems that Jump and crouch has been moved to ASP_HeroTPP_Blueprint and hard coded to only work with ASP_Character class. This is very confusing. First, Its different than every method documented & video tutorial created. Secondly, its not generic enough to allow you to use your own characters.
Both of these should really be addressed imo.
As you discovered, source of issue is that ASP_HeroTPP_Blueprint AnimBP casts to ASP_Character specifically. AnimBP needs to cast to class using it to reference variables it needs when specifying Crouch and Jump animations.
There are two things you can do to adjust this:
Instead of duplicating ASP_Character Blueprint, make a child Blueprint of class ASP_Character. This way you can make any adjustments you need and still access variables from parent class.
Or you can swap Cast to ASP_Character nodes with Cast to MyASPCharacter (or whatever you choose to name your Character). If you do it this way, make sure you get a fresh version of variables being referenced; in case where you make a duplicate of ASP_Character, you would need to Cast to MyASPCharacter and then pull off that for JumpButtonDown and CrouchButtonDown to access that class’ variables, because old variables are referencing original BP.
This may seem complicated, but generally you need to make sure that AnimBlueprint you’re using for your character only references character BP or its parent. If you’re seeing documentation or tutorials that say otherwise, please let me know where and I can get those updated. I will also make a feature request of a node that casts to current CharacterBP that is using AnimBP, but I don’t know how possible that is.
Hope that helps!
Wouldn’t a more traditional solution to be to use an Interface. You could provide a getJumpButtonDown, getCrouchButtonDown interface and then have AnimationBlueprint check if actor implements that interface instead of hard coding directly to class.
Seems this would make content more accessible to users, provide a generic solution, as well as making it so that this information is no longer “hidden” in depths of anim event graph.
An interface would present a couple of new problems, such as possibly sending same data to multiple characters using same interface, as well as introducing another element in communication process between assets. It’s certainly possible, and you are welcome to set it up that way if you prefer.
Using AnimBP’s Event Graph is a standard part of animating a character in UE4, and content creators felt this was most efficient way to handle Jump and Crouch animations in this case. If you feel that this is not communicated properly, please let us know where you are seeing something different and we can update that. It looks like Technical Details for Animation Starter Pack doesn’t exist on wiki page, so I can at least see about getting that added and include information discussed here.
I believe reference documentation would equally resolve my complaint. I just spent a very long time searching for why jump wasn’t working on my characters to find it tucked away in my Anim Blueprint. I’m not an animator so I don’t believe I would have ever looked there except I resorted to opening every blueprint trying to find where Jump was actually being called.