SetViewTargetWithBlend bug!

When I tried blend from one camera to other I watched that angle was not minimal and camera did circle around self.
I’m looked at code which doing interpolation and finded that code has little bug.
In APlayerCameraManager class, method BlendViewTargets and method BlendViewInfo from struct FMinimalViewInfo rotate camera with code:

const FRotator DeltaAng = (OtherInfo.Rotation - Rotation).GetNormalized();
Rotation = Rotation + OtherWeight * DeltaAng;

But it not working correctly when rotators has ~180 degrees(Yaw, Pitch or Roll), something like 179.999995 or -179.99999 etc.

I think that it is rounding error, because I see that only when my first rotator has Roll = -179.99999999 and second rotator has Roll = 0.000000001. When its two rotators substracted I had rotator with Roll = -180.00000001(something like that) and when normalized it I get wrong Roll = 179.999999999. It upsets me((

Help me please with it. Thanks in advance.

i think, this is due to the values you are getting… lets suppose you have rotation 180 to -180.
if you blend 175 with -175 , although minimal difference is 10 degree, but blend will consider as 350degree difference… it’ll blend from 175 to 0 then -175.

simple way to solve this is use ‘Clamp Axis’ node, (a function that convert -180 to 180 → 0 to 360).
then what you have to do is, always clamp from closest side, and take modulus if you get any unwanted values.
this is will solve your problem.

let me know if it works.

thanks

I understand it, but i don’t understand how I can fix it.
I tried to use something like that:

Rotation = FQuat::Slerp( Rotation.Quaternion(), OtherInfo.Rotation.Quaternion(), OtherWeight).Rotator();

But it doesn’t help me((

can you please share your project ?

I’d love you help you out…

Hello seka97,

Are you still experiencing this issue? If so, could you do as TahaRizvi asked and provide a copy of your project so that we may take a closer look into this issue?