To easily setup a unit to be produced by a factory depending on a selected type (which should be specified like a recipe for a unit) I would like to be able to use the same AnimBP which specifies certain animation states (currently: idle, attack, walk), but replace the current animations with new ones of the new animation. I realize that I have to change the skeleton, too. Now unreal tells me my skeleton is not compatible with the blueprint.
This sucks alot as it looks like I would need to create basically an identical blueprint just for every other unit I would like to implement (with a somewhat different skeleton).
Is there a way to implement this without creating new AnimBP for all kinds of units?
To replace an animation, you can simply have the clip as a variable, and then based on the rules you want ( random of whatever ) you can specify which animation you want to assign.
Regarding switching the skeleton, by default you can’t do that, at least using BP, C++ not sure, since you do have a target skeleton in Class Settings > Class option > Target Skeleton ).
But if you’re using UE5 you can use the IK Retargeter, so that you can have a single “base character” and switch between different characters( with different skeletal heirarchies ) with few steps. In this video you can see how I’m able to drive 4 characters with a different skeletal hierarchy using a single AnimBP.
Thank you! I was already doing just as you said using variables to determine which animation to play. However, because some test animations did not share the same skeleton, I ran into the issue described here. I did some research but so far found no solution to the skeleton issue aside of truely using different animation blueprints, which is very ineffective with respect to the required code to write.
However, this IK Retargeter sounds really interesting, thank you for that. We are using the most recent UE5 version, so it should be available.
Is there perhaps some pure C++ solution? I.e. what about just leaving Animation Blueprints behind and resorting to just playing animations yourself and switching between them according to one’s own code/state machine? Or is there a definite need for animation blueprints?
I’m not expert regarding C++, but if you want to code your own solution is the way to go.
However I strongly suggest you to take a look at the IK Retargeter, since it can manage pretty much most cases.
Regarding getting rid of the AnimBP alltogether, honestly there are usefull stuff there, from handling simple things to most advanced, so I advise you to use it and just see what is the best solution to solve your issue…as mentioned, IK Retargeter is a super usefull solution to finally manage different characters without relying on a an external DCC.
Alright, thank you for your advice! If anyone has another idea how to solve/prevent “Blueprint explosion” as explained post it, I am still very interested to hear about the solution of others.
Is that a pre-baked solution, or Live-change in Game solution?
Meaning if we use UE5’s IK retargeter, do we need to have the animation calculation as a new asset? (thus the project build needs to save many copies of similar anims.)
Or can we use the IK retargeter to perform the anim calc during the game, on different skeletons, to force them to use the same anim asset? (thus a build doesnt have to pre-save 20 copies of Run, jump anims.)
IK Retargeter can work as a kind of retargeter setup, where you can choose what animations to retarget, but then you need to create another AnimBP for that character and use the retargeted animations, or you can use IK Retargeter to work in realtime, where you create a dedicated AnimBP for each characters, but inside the AnimBP you use the “Retarget Pose from Mesh” node, which uses the same animations of your “base” AnimBP, and then applies a retargeter setup on top of the animations.
I’m not sure about performances, but I guess that you can have your main character and a child which you can swap in realtime, based on inputs, like analog directions on the gamepad.
By doing so, you have as many AnimBP as the characters you want to use, but you can act smart and “load” one the one you need at that time based on inputs.
Can you tell me what people are calling this [IK Retargeter to work in realtime] so I can search for setup tutorials? AnimBP “Instance” or “realtime Retargeter”?
Can you clarify which is the lowest engine version that can do this (without bugs)? UE5.2 or 5.3; or is 5.1 sufficient? (Im assuming that 4.27 didnt have these nodes.)