I have a tank AI that moves with MoveToLocation function, and uses pathfinding. While moving to the location it has to rotate in the direction it is going.
I should accomplish this with the following code, in which i try to find the rotation between it’s location and direction.
FRotator newRot = UKismetMathLibrary::FindLookAtRotation(GetPawn()->GetActorLocation(), velocity); newRot = FRotator(0, newRot.Yaw + 90, 0); Cast<AEnemyTank>(GetPawn())->SetActorRotation(newRot);
I do +90 because it faces in the right direction when i do +90.
This works but it does weird things while it is turning.
I have a short video (only 10 mb) that shows the problem. I’ll provide a link to a wetransfer file because i can’t upload video here.
If you have an idea how to fix this i’d like to hear it :).