[mw_shl_code=cpp,true]void ARotationSystemActor:oRevolution(AActor* InActor, const float& InRotateAngle, const FVector& InRotationUpVector, const FVector& InStartLocation, const FVector& InCenterDot)
{if(!InActor)
{
return;
}
// 起始位置到中心点的向量
const FVector axisToBrickDirection = InStartLocation - InCenterDot;
// 半径
const float Radius = axisToBrickDirection.Size();
// cal location by axis and angle
const FVector nextBrickLocation = axisToBrickDirection.RotateAngleAxis(
InRotateAngle, InRotationUpVector.GetSafeNormal() * Radius;
const FVector newLocation = InCenterDot + nextBrickLocation;
InActor->SetActorLocation(newLocation);
}[/mw_shl_code]
|