- Home /
Create Arrow grouping mechanic like the game arrowfest?
Hi, I am creating a game that kind of requires the mechanic of arrows in the following game arrow fest (https://www.youtube.com/watch?v=7njziDe4mts). I can't seem to figure out how to do that arrow grouping and circling? I thought of spawning objects around player in circles and I used the following code
private void UpdateCircle()
{
for (int i = 0; i < instantiateList.Count; i++)
{
float angle = i * Mathf.PI * 2f / instantiateList.Count;
Vector3 newPos = new Vector3(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 0);
instantiateList[i].transform.localPosition = newPos;
}
}
But it didn't work as I wanted and in the video. I wanted to ask if there is a better way to achieve such seamless grouping of objects around the player? Any ideas, tips, resources will be appreciated.
Hi! Were you able to find a better solution for this problem?
Answer by AlgoUnity · Sep 23, 2021 at 08:23 AM
I think the arrows are just spiraling out from the center with a consistent expansion, when there are a lot of arrows you can see the colors make a sort of fractal pattern. Basically, for each i you make the angle smaller and smaller, and you multiply the radius by i times a small distance. The small distance should also get smaller and smaller as i gets bigger. Another way you can do it is to make a Vector3 called "toNextArrow" or something, and every time you add an arrow you rotate this vector and make it slightly longer. The next arrow is then lastArrowPosition + toNextArrow. It will take a lot of tweaking to make it look nice though so make it easy to change some of these variables in the inspector.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
GUIText Instantiation and Update the Instantiated Text. C# 1 Answer
How to spawn gameobject from host to all clients 1 Answer
Destroying childs and Instantiate [C#] 0 Answers