Download

Slerp Quaternion flipping issue

Hi everyone,

I am stuck from days now i really need your help to fix that.
i try almost everything, and i am always stuck at the end.

I try to slerp between two rotating object, so the slerp work’s fine, the issue is as the source and the target are dynamic.
So it can happen that the quaternion of the source or the target flip and this generates a calculation error in the slerp.

is there a way for each frame to define a starting point for the quaternion which would prevent it from flipping?

i try on c++ but maybe is the way in blue print ?



FTransform SourceTransform = getLocationTracking(indexToLookStart);
FTransform TargetTransform = getLocationTracking(indexToLookStart + 1);

// On recupere les rotation de la source et du target
FQuat QSource = SourceTransform.GetRotation();
FQuat QTarget = TargetTransform.GetRotation();

// ici on force le plus court chemin ce qui evite des jump
EnforceShortestArcWith(QSource, QlastSource);
EnforceShortestArcWith(QTarget, QlastTarget);


resultRot = SlerpN(QSource, QTarget, blendTargetActor);




video of my issue
https://youtube.com/watch?v=j7a2uk7iOjM

thank you very much for your help.
Best Regards,
Daniel