散开 "arc" 个卡片网格

Fanning out an "arc" of card meshes

我有 n 张牌。每张卡片的宽度为 a 个单位。
许多流行的纸牌游戏在 "fanned out" 位置显示一手牌(见下图),我也想这样做。通过使用以下公式,我可以将卡片放置在弧形中:

// NOTE: UE4 uses a left-handed, Z-up coordinate system.
//  (+X = Forward, +Y = Right, and +Z = Up)

// NOTE: Card meshes have their pivot points in the center of the mesh
//  (meshSize * 0.5f = local origin of mesh)

// n = Number of card meshes
// a = Width of each card mesh

const auto arcWidth = 0.8f;
const auto arcHeight = 0.15f;
const auto rotationAngle = 30.f;
const auto deltaAngle = 180.f;
const auto delta = FMath::DegreesToRadians(deltaAngle) / (float)(n);
const auto halfDelta = delta * 0.5f;
const auto halfMeshWidth = a * 0.5f;
const auto radius = halfMeshWidth + (rotationAngle / FMath::Tan(halfDelta));

for (unsigned y = 0; y < n; y++)
{
    auto ArcX = (radius * arcWidth) * FMath::Cos(((float)y * delta) + halfDelta);
    auto ArcY = (radius * arcHeight) * FMath::Sin(((float)y * delta) + halfDelta);
    auto ArcVector = FVector(0.f, ArcX, ArcY);

    // Draw a line from the world origin to the card origin
    DrawDebugLine(GetWorld(), FVector::ZeroVector, ArcVector, FColor::Magenta, true, -1.f, 0, 2.5f);
}

这是《炉石传说》中的 5 张牌示例:

这是杀戮尖塔中的 5 张牌示例:

但是我产生的结果是,好吧……次优:

无论我如何调整变量,最左边和最右边的牌都会被挤到手上。我想这与圆的点如何分布有关,然后向下挤压(通过 arcHeight)形成椭圆?在任何情况下,您都可以看到结果远非相似,即使您仔细查看示例参考,您也可以看到从每张卡片的中心存在一条弧线(在这些卡片在本地 [=32 中旋转之前) =]).

我怎样做才能获得更均匀的 spaced 弧度?

您的分布看起来确实像一个椭圆。您需要的是一个非常大的圆圈,圆心远离屏幕底部。类似于下面的圆圈,其中黑色矩形是您绘制卡片的屏幕区域,绿点是卡片位置。注意圆的半径大,卡之间的角度小