【UE4】C++与蓝图分别实现3点位置夹角计算

C++

const FVector2D& Pt1 = 1point;
const FVector2D& Pt2 = 2point;
float EdgeRadians1 = FMath::Atan2(Pt2.Y - Pt1.Y, Pt2.X - Pt1.X);
const FVector2D& PP1 = 2point;
const FVector2D& PP2 = 3point;
float EdgeRadians2 = FMath::Atan2(PP2.Y - PP1.Y, PP2.X - PP1.X);
float Angle1 = Math2d::GetNormlizeDegress(-FMath::RadiansToDegrees(EdgeRadians1));
float Angle2 = Math2d::GetNormlizeDegress(180.0F - FMath::RadiansToDegrees(EdgeRadians2));
float Angle = Math2d::GetNormlizeDegress(Angle1 - Angle2); 

蓝图

【UE4】C++与蓝图分别实现3点位置夹角计算_第1张图片

你可能感兴趣的:(C/C++,UE4)