So I want to drive my Animation Blueprint from my Player State, specifically because I have 4 different meshes (TP Player, TP Weapon, FP Arms, FP Weapon) and the Player State (According to the documentation) is:
So I have not only the stats like Health and Stamina, but I also have the current states of the player like: IsJumping, IsCrouching, etc.
My question is, is the right approach and how do I actually go about driving the Animation Blueprint from my Player State? I have tried a few different ways of doing this and I don’t seem to be getting it right. Google has not provided me with much answers and the search on these forums have also not provided me with much guidance in the matter.
for all the meshes like weapons and cloths best way to go is just using master pose (skeletal mesh->set master pose(parent)), then set only character animation blueprint. from its event graph you can access player state through try get owner pawn->get player state, then store all required for animation properties in variables, finally do the rest with anim graph e.g. blending animation, driving anim state machine, and so on… using this approach and master pose will drive all attached meshes follow character, so you animate once, and other attachments you get animatied for free.
btw, why storing things like “isJumping” in player state(i mean it designed for more global player stuff, for example inventory if this is game with respawns, player score, etc…) if all this is already part of Character class(if you are using it) which you can get by casting(to Character or other class you are actually using) owner pawn in anim bp?
sorry for a bit generalized answer, now you should be able to find more detailed(and correct) info in docs.
@Superbelko: Actually looking at my code now, I have no idea what I was thinking by putting that stuff in Player State. I blame lack of sleep … shrug
Anyway, I will refactor my code now and move those things out of Player State.
I need to do the animations my way because of the way the model was created and the original animations created … it is actually a model I have ported from another engine.
doesn’t matter, i assume it is already skeletal mesh, so just open bind pose file in your fav 3d modeling program, put all cloths/weapons/attachments to that pose, bind them to that same skeleton, export skeleton and attachments(each mesh separatedly), go with steps i described above.
as for animation states like inAir/jumping it is better to evaluate this conditions locally, so it will blends nicely with what character is doing as seen by player. check character movement and relevant data in anim blueprint’s event graph, then use blending nodes and state machines in anim graph - i think best example for both is shooter game and standard mannequin, shooter game also has complex example for handling jumping/loop/landing cycle and more.
ah forgot to say, binding meshes to same bind pose as character is mainly for clothing, simple stuff like swords and shields could be simply attached with sockets in UE, though for animation purposes i think it is worth adding joints to skeleton just for making cleaner animation.
Thanks … I got it all working in the end … remove the states out of the Player State and they are now driven by the Pawn which is in turn controlled by the Controller. My animations all have AnimNotifies on them for the particles and the sounds and it is all working fine.