I get a bone’s position using USkinnedMeshComponent::GetBoneLocation in my character 's tick function. But I find the value seems to lag a lot. I guess it’s because the tick function doesn’t always get called AFTER animation update. So my question is: is there a post animation update function callback/event in agent of actor? If there isn’t, how could I get sync bone position in C++?
Now the example above then uses BP to handle the notify, but it can also be done in C++. You will need an AnimInstance C++ class which your actor uses and name it like “AnimNotify_YourNotifyNameInAllCaps”.
For example if you named the Notify to be “RELOADEND” in your animation:
Thanks. But I don’t mean after an animation finished playing. I mean after the animation engine has evaluated all the bones and vertices on the skin is each frame.
For example: currently in my code the execution order is like:
frame 1:
my actor ticks, where I get my bone position.
then animation engine updates, where all the bones are placed.
then the skeleton is rendered on screen.
frame 2:
my actor ticks, where I get my bone position.
then animation engine updates, where all the bones are placed.
then the skeleton is rendered on screen.
See? The animation engine always updates the skeleton of the actor AFTER the tick of the actor. I’m always one frame late. What I got is not what is rendered on screen.
I need the opposite: get the bone position after animation engine update and before next frame.
I see what you mean, have no experience trying to solve this using the engine. I have however had a similair use case where I would cache the last/previous position and use it in the actor tick. This ofcourse means you will have not any data on the very first frame.