So I’m not sure about this if it’s a bug or an intended behaviour and I accidentally just incorrectly setup something or something works differently than I thought.
I have a custom anim node that controls stuff on my character, including some spine rotation. Using Evaluate_AnyThread(FPoseContext& Output)
, I modify some bones rotation etc.
I pass down my spine rotation value through property binding in the animation graph and everything works fine. One thing is that 2 of the spine rotation axis are inverted, so I modify the pitch to be the roll and vice versa in the anim node. So just in plain code:
void FOakAnimNode_BodyRig::Evaluate_AnyThread(FPoseContext& Output)
{
BasePose.Evaluate(Output);
if (!CanEvaluate())
{
return;
}
// Modify spine rotation since pitch and roll are reversed and pitch is inverted.
SpineRotation = FRotator(
SpineRotation .Roll,
SpineRotation .Yaw,
-SpineRotation .Pitch).GetNormalized();
...
Everything works fine, since every time Evaluate_AnyThread is called, just before, SpineRotation gets updated to the value of the SpineRotation variable from the main thread so overwriting the value doesn’t matter since it will get updated just before the next Evaluate call, or so I thought. On authoritative simulated proxies on the servers, sometimes the spine rotation of characters would for one frame invert. It seems like the SpineRotation value isn’t refreshed just before calling Evaluate_AnyThread which causes it to have its previous value of reversed Axis, so they get reversed back and this causes the SpineRotation to be wrong.
So my questioning is, will the anim node input values always be updated before Evaluate_AnyThread is called which would make my situation some sort of bug, or should I consider that sometimes it might not be updated because of some multithreading dark magic and I shouldn’t modify those input values in the anim node code if I want them to remain accurate and use different variables to modify based on the input variables?