Answers for "how to make game objects spread in a specific vector"

0

how to make game objects spread in a specific vector

float radius = 1f;
 for (int i = 0; i < 8; i++)
 {
     float angle = i * Mathf.PI*2f / 8;
     Vector3 newPos = new Vector3(Mathf.Cos(angle)*radius, y, Mathf.Sin(angle)*radius);
     GameObject go = Instantiate(GameObject.CreatePrimitive(PrimitiveType.Cube), newPos, Quaternion.identity);
 }
Posted by: Guest on July-10-2020

Code answers related to "how to make game objects spread in a specific vector"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language