- Home /

# Instantiate objects in an arc shape

I have this function that moves the object around a circle:

```
void arrangeCardsInHand(Player newPlayer){
int numCards = newPlayer.Hand.Count;
var centrePos = new Vector3(0, 300 ,0);
for (var cardNum = 0;cardNum < numCards;cardNum++) {
var i = (cardNum * 1.0 / numCards);
//angle in radians, full circle has a radian angle of 2PI, so we find the radian angle between
//2 of our points by dividing 2PI by the number of points
var angle = (float)(i * Mathf.PI * 2);
var radiusX = 10000.0;
var radiusZ = 4300.0;
var x =(float)( Mathf.Sin (angle) * radiusX);
var z = (float)(Mathf.Cos (angle) * radiusZ);
var cardName = newPlayer.Hand[cardNum].cardName;
GameObject.Find(cardName).transform.position = new Vector3(x, 0 ,z) + centrePos;
}
}
```

**I want the cards to be arranged in the top arc of the circle (1/4 of a full circle).**

I have no idea how to work out the starting and the ending point into this formula tho. I'm also open for other ideas (like beziers or w/e) if you think this is not the best solution for what I want to do.

Any answer is appreciated.

You should be doing this using game objects in Unity.

Never calculate anything.

Have your object that makes the card....

Now have anther object (perhaps called "spinner"), put "spinner" where you want, at the center of the circle.

Put the card-maker inside spinner, and move it out whatever radius you want. It is trivial to adjust all this in the editor

now simply use

# "Rotate"

.

to rotate the spinner

http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html

it couldn't be easier. Why use machine code -level program$$anonymous$$g when you have a whole astounding game engine at your disposal?

You're right, man. This is a way better solution than what I was using. Although it requires a little bit of tinkering because my actual implementation is a bit more complicated but I will try this method out ;)

Go for it. it's great because you can just "move around" that "holder" object, and so on. It's the only way to fly.

**Answer** by DaveA
·
Sep 21, 2013 at 08:30 AM

Something like:

var angle = (float)(i * Mathf.PI * 2) + Mathf.PI / 4; // add 45 degrees

and adjust i to end at 135 degrees (Mathf.PI * 3 / 4)

Yeah! almost there :D This worked for me:

var angle = (float)(i * $$anonymous$$athf.PI * 0.5) - $$anonymous$$athf.PI / 4;

Thanks, brosef!

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

Measuring the Angle Between Two Transforms for t Param of Quaternion.Slerp 1 Answer

Trouble calculating Arc offset position 1 Answer

Arc Movement Lerp, Mathf.Sin and Mathf.Pingpong question 1 Answer

How can I calculate the Vector3 b using Vector 3 a pos with an angle? 1 Answer

Find the right angle for certain distance with arc effect? 1 Answer