Search code examples
game-enginegame-developmentunreal-engine4unreal-engine5

Unexpected rotation of the gun's turret when it arrives at a certain value, How do i can solve that?


Video shows the problem

Click here to watch the problem on YOUTUBE

I am working on a gun turret game. The turret should rotate based on the rotation of the camera's view, all is done perfectly. I am using FInterpTo to make the rotation smooth.

The problem is: Unfortunately, unexpected something else has done, When the rotation arrives at 180, the rotation will be reflected. I tried a lot and a lot to solve this problem but without any results. If anyone had the same problem, I hope to help me.

The blueprint of Turret Rotation with FInterp function

(Yaw rotation) variable represents the value of turret rotation enter image description here

enter image description here


Solution

  • The answer is:

    Rinterp to instead of using FInterp to