I have two characters: player and horse. Both player and horse have animations that looks good only when they play in parallel. So how I can synchronize them animations? As I understand, sync groups can work only with one skeleton, but in my case I have two
I am now experiementing with Control Rig, but in v4.25 is very very buggy. As I understand, it’s used for another things (like procedural animations with IK), but I have ready-made animations with same lenght for horse and rider, so I just need to play it at the same time.
So I will try solution with notifies that you suggested
Thank you for answer.
Not sure if you’ve looked into it, but as I understand it, this is what the Control Rig feature is for, so maybe you should have a look at that. It’s currently experimental but I believe it is entering Beta as of 4.26. I have no experience with it myself so I can’t tell you whether it will be exactly right or how hard it is, but I believe it is probably worthwhile checking out.
Alternatively in the past I have triggered animations from different skeletal meshes that are interacting by using animation notifies this gives you control over exactly when you want to trigger an animation based on another animation, it’s not full proof but does work.
If they’re the same length then you just need to tell the game to play both on the same frame time in game no? So long as they get the instruction on the same frame they should start at the same time and in sync.
You can set up a function to do so in C++ like so:
USkeletalMeshComponent* RiderSkeletalmesh, HorseSkeletalmesh;
UAnimationAsset* Rideanimation, Horseanimation;
void PlaySyncedAnimation()
{
RiderSkeletalmesh -> SetAnimation(Rideanimation);
RiderSkeletalmesh->Play(bLooping);
HorseSkeletalmesh -> SetAnimation(Horseanimation);
HorseSkeletalmesh->Play(bLooping);
}
It gets a little more nuanced if you are using an anim BP to control other animations for your character, but that should be it.
(Apologies for Thread Necro)
Struggling with the same issue. How do you sync anim components in an AnimBP (e.g. horse riding)? For cinematic or non-realtime applications, there are lots of ‘hacks’ you can try and use to get the anims to play at the same time. But in a real-time anim graph anims can desync very easily.
Most commonly, you use a Blendspace for locomotion with a velocity variable. But no matter how ‘equal’ you try to make it (e.g. driven by the same velocity variable, identical pre-requisite notes), they always desync. Would be nice to fix this.
How can you use control rig to sync these anims?
(another sorry for necro thread and late answer but I guess many people encounter this problem so I think I should post that)
Honestly, I am still struggling with this. But I found out that if mesh components are part of the same actor, desync happens way more rarely. So I would suggest instead of attaching player character to the socket on the horse character destroying the character and adding dummy character mesh to the horse. That way mesh components would be updated with the actor update so It will definetily happen at the same time (at least as I understand). That solution works quite well with simple anim bps, but when things got advanced, for some reason I experienced desync again…
Also another solution is to use physical animations instead of ready sequences, as I do now, but even good physical animation could not be compared to the made-by-hands one, sadly : (
It’s a shame that such problem is so hard to be handled…
Yes that helps. I have also toggled with ‘restart blendspace’ node on the AnimBP Graph, which helps a bit more, but it still does not guarantee a sync. I would have thought there could be some sort of feature or function that can ‘tie’ anim graphs together so that they execute on exactly the same logic on the same tick?
There appears to be a solution along these lines in 5.4, using a database of animation clips and best pose matching, but not sure that helps.
I have used animation events to set the animation position for the given frame. This approach requires the animation be off (not running) and you need to set each animation clip to their desired position every frame yourself. I have no need for this approach but I have shown it works perfectly well; was using 5.2 when I prototyped it.
Recently I researched that issue again and found some good way to deal with that problem!
If you want your animation to be synced perfectly without setting ‘reset on entry’ to true, you need to use in your character animbp sequence and blendspace evaluators instead of regular sequences to play animations at the same time as the horse ones:
So how do you get a “Normalized Time”? As you can’t get animation time using Blueprints, I used some good workaround. I just added to all of my horse animations curve named “Time”. There I set two keys: one on the start of animation with 0 value, and another one on the end of animation with value 1.
Then I just access that value in character’s anim bp by “Get Curve Value” node:
Done! Now your anims can be perfectly synchronized!
you can’t even imagine how happy I was when I figured this out hahahah
Hope this answer helps!
this sounds like a very promising and fairly easy approach. I will give it a shot!
I know this was posted a long time ago, but if someone reads this today, I just want to point out that while this solution might work well for small projects or demos. Larger projects may require animation update optimization or animation frame budget considerations. This approach could then lead to animation desynchronization.
thanks for the hint! Do you may have another approach to solve that problem in that case?