I am creating the card game and i wanted to order the cards as a bezier curve i've ordered the cards with this formula Quadratic Bézier curve formula
but now I have to get closer to each other as the number of cards decreases. Is someone can help me?
public void SetCardPositions()
{
Array.Clear(Cards,0,Cards.Length);
for (int i = 0; i < transform.childCount; i++) {
Cards[i] = transform.GetChild(i).gameObject;
}
int CardCount = Cards.Count(x => x != null); ;
Transform[] CardInPlayerHand = new Transform[] {};
for (int i = 0;i < CardCount; i++)
{
System.Array.Resize(ref CardInPlayerHand, CardInPlayerHand.Length+1);
CardInPlayerHand[i] = Cards[i].transform;
}
//SetCardPositions
for (int i = 0; i < CardInPlayerHand.Length; i++)
{
float t = 0;
if (i != 0)
t = ((1f / (CardInPlayerHand.Length - 1f)) * (float)i) + ;
if (CardInPlayerHand.Length == 1)
t = 0.5f;
Vector3 CardOrigin = (1 - t) * ((1 - t) * DeckPointPositions[0].position + t * DeckPointPositions[1].position) + t * ((1 - t) * DeckPointPositions[1].position + t * DeckPointPositions[2].position);
CardInPlayerHand[i].DOMove(CardOrigin,1);
}
}