GetSafeNormal() work around

Hello!
I had a problem with GetSafeNormal(), which resulted in my AI tanks flying with abnormal speed.
So right now, I’m using my normalization inside RequestDirectMove(). If someone has the same problem, here’s my solution:

#include “math.h” // add this to include section to be able to use sqrt()

auto SquareSum = (AIForwardIntention.X * AIForwardIntention.X) + (AIForwardIntention.Y * AIForwardIntention.Y) + (AIForwardIntention.Z * AIForwardIntention.Z);
float Scale = 1/sqrt(SquareSum);
AIForwardIntention = FVector(AIForwardIntention.X * Scale, AIForwardIntention.Y * Scale, AIForwardIntention.Z * Scale);

Privacy & Terms